Re: [formalchemy] Render relation class content instead of object address

50 views
Skip to first unread message

Gael Pasgrimaud

unread,
Jan 17, 2013, 3:58:48 AM1/17/13
to forma...@googlegroups.com
Le 16/01/2013 18:20, Shu Lin a �crit :
>
> Hi,
>
> I am a newbie on Python and Pyramid. I have tried to use the
> FormAlchemy to give the admin capability to my pyramid project. It
> basically works for me. But, while I try to render the one-to-many
> relationship, it always give me the list of relation object like below:
>
> <dp_common.models.users.User object at 0x1110241d0>
>
> According to this document
> http://docs.formalchemy.org/formalchemy/forms.html, it seems correct.
> But, from the blog on this link
> http://spyced.blogspot.com/2008/10/formalchemy-10.html, it seems we
> can get the content of relation object rendered, instead of just a
> python object address. But, I couldn't find a complete example for
> this. All the information on the Internet is piece by piece.
>

Your model must have a __unicode__ methode

class User(Base):

def __unicode__(self):
return name

> Thanks a lot,
>
> -Shu
>
> --
> You received this message because you are subscribed to the Google
> Groups "FormAlchemy" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/formalchemy/-/SvlmY2_7EPYJ.
> To post to this group, send email to forma...@googlegroups.com.
> To unsubscribe from this group, send email to
> formalchemy...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/formalchemy?hl=en.

Shu Lin

unread,
Jan 17, 2013, 12:58:45 PM1/17/13
to forma...@googlegroups.com
Got it. Thanks a lot!
-Shu
Reply all
Reply to author
Forward
0 new messages