On 4/11/06, Scott Finnie <[EMAIL PROTECTED]> wrote:
> class Vendor(meta.Model):
> class META:
> admin=meta.Admin()
> name = meta.CharField("Name", maxlength=100, core=True)
>
> def __repr__(self):
> return (self.name)
>
> class ServerModel(meta.Model):
> class META:
> admin=meta.Admin()
>
> vendor = meta.ForeignKey(Vendor)
> model = meta.CharField(maxlength=200, core=True)
>
> def __repr__(self):
> return (self.vendor.name + " " + self.model)
> --------------------------------------
>
> When I run this, everything's fine with Vendors. However the
> ServerModel list shows (None) for each entry created instead of the
> expected <Vendor> <ServerName>. Also if I click on an entry to edit I
> get a traceback error listing. I also tried replacing self.vendor.name
> with self.vendor.get_name() but with the same results.
Hey Scott,
Change the __repr__() of ServerModel to this:
return (self.get_vendor().name + " " + self.model)
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---