I'm using Django's admin interface to view the fields of a table. One
of these fields in a foreign key reference to another table named
"Search". By default, Django's admin interface shows me "[Search
Object]" in the foreign key column. I'd prefer to see some identifying
information about the Search Object, such as it's primary key and its
timestamp. Is that possible?
yep. just add
def __str__(self):
return self.timestamp
to your "search" model class. The __str__ method is the default
"string representation" of a python object. you could also do
something fancy like:
return str(self.timestamp) + " (" + str(self.id) + ")"
Thank you very much.
--Robert
>
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---