On Sep 18, 9:17 am, ksfguy <[EMAIL PROTECTED]> wrote: > Hello!, > > There are two models > > -------------------------------------------------------------------------------------- > > class Parent(models.Model): > name = ... > > class Child(models.Model): > parent = models.ForeignKey(Parent) > age = ... > > --------------------------------------------------------------------------------------- > > Can I display chidren's age, when I using [Parent - change_list] > InlineModelAdmin option do what I need when I editing Parent object. > But, I can't use it in the change_list. > > Thank you!!
The problem is of course that there's more than one child for each parent, so you can't just display a simple 'age' field. What you can do is provide a method that will concatenate the ages of all the children related to that parent. class Parent(models.Model): .... def children_ages(self): return u', '.join([c.age for c in self.child_set.all()]) children_age.short_description = 'Ages of children' and in the admin class: change_list = [name, children_ages] See here: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#list-display -- DR. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---