Re: loop user.get_profile displays none in a template

47 views
Skip to first unread message

Matt Schinckel

unread,
Oct 18, 2012, 11:33:48 PM10/18/12
to django...@googlegroups.com
user.get_profile() returns a model instance, not a dict. Model instances have no .items() method.

Matt.

David Lee

unread,
Oct 18, 2012, 11:52:39 PM10/18/12
to django...@googlegroups.com
how can I  get each key and value by loop or another method?  I wanna display all infomations about a model instance

在 2012年10月19日星期五UTC+8上午11时33分48秒,Matt Schinckel写道:

smcoll

unread,
Oct 19, 2012, 11:57:07 AM10/19/12
to django...@googlegroups.com
i think you'd have to make a method on UserProfile that returns a dict of some of its attributes, and iterate over the result of that method in your template.  That, or create a templatetag that adds it to the context.
Reply all
Reply to author
Forward
0 new messages