am still having trouble making it work
What data structure type do I vars in so that user can return next day and
have bookmarks work? Right now is stored in "string" field in a regular
table. Tried "json" field type but Postgres rejected. Is it supposed be
some sort of dictionary field? Field('saved_menu_vars', 'string')
VIEW THAT CAPTURES CURRENT PAGE VARS
{{import json}} <-- side question: Why "import json" only works in view
and not controller?
{{=A('Add this page or manage bookmarks', _href=URL('default',
'manage_menu_favorites', vars=dict(specificURL = request.url,
saved_menu_vars = json.dumps(request.get_vars))), _class='btn btn-warning
btn-lg',
_style='font-size:120%;float:left;padding:10px;margin:10px;text-transform:
capitalize;')}}
CONTROLLER THAT SAVES VARS INTO A TABLE
justCreatedBookMark =
db.menu_favorites.insert(menu_favorites_redirect_parms =
json.loads(saved_menu_vars), menu_favorites_title =
form.vars.title_of_your_bookmark, user_fk = auth.user_id)
VIEW THAT DISPLAYS BOOKMARKS
{{for r in session.menuFavoritesSet:}}
<li>{{=A(r.menu_favorites_title,
_href=URL(r.menu_favorites_url,
vars=json.loads(r.menu_favorites_redirect_parms)))}}</li>
{{pass}}
Is there a better way to test contents of saved vars?
am a little confused with: **request.get_vars
The vars are stored in a table. How does that get them out of their field?
thanks
Alex
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.