Hi, You can do it by adding:
class Meta: ordering = ['name'] to you Name class. Regards, Alex A. On Dec 24 2008, 9:17 am, "Aaron Lee" <waifun...@gmail.com> wrote: > Hi I have a ManyToMany field names in my class and I would like to show the > names in sorted order (according to 'name') in the admin interface when I > edit a Person. Right now it's showing by the pk order of Name. What's the > right way to override this order? Thanks > class Name(models.Model): > name = models.CharField() > > class Person(models.Model): > code = models.CharField() > names = models.ManyToManyField(Name) > > class PersonAdmin(admin.ModelAdmin): > list_display = ('code',) > ordering = ('code',) > > admin.site.register(Person, PersonAdmin) > > -Aaron --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---