---------------------
I changed my subscription to my gmail-account because I'm not sure if my
email went trough. Here is it again.
---------------------
I do the following to get data out of a related table/model:
Of course you could access your other model via __unicode__...
Or, simply write a function for your model and use a callback in your
list_display:
Here an easy "quick and dirty" example:
class othermodel(models.Model)
importantfield=models.CharField(....)
class mymodel(models.Model)
value = models.CharField(....)
FK_othermodel= models.Foreignkey(othermodel)
def get_importantfield(self):
return self.FK_othermodel.importantfield
In your admin.py call
MymodelAdmin(admin.ModelAdmin)
list_display=['get_importantfield']
Hope it helps!
Mathieu
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment