OK Thanks! That explains a lot.

Wim

On Mar 8, 2:54 pm, derek <[email protected]> wrote:
> On Mar 8, 2:46 pm, Wim Feijen <[email protected]> wrote:
>
>
>
>
>
> > Hello,
>
> > In my admin interface, the data isn't ordered as expected. What I get
> > is:
> > Provincie/Land   Type
> > Limburg     Provincie
> > Groningen  Provincie
> > Utrecht      Provincie
> > etc.
> > which clearly isn't alphabetical order, while I do specify that
> > provinces should be ordered that way. In my python manage.py shell the
> > provinces are ordered alphabetically. What could be wrong?
>
> > admin.py:
> > class ProvinceAdmin(admin.ModelAdmin):
> >     list_display = ('name', 'type')
> >     actions = None
>
> > admin.site.register(Province, ProvinceAdmin)
>
> > models.py:
> > class Province(models.Model):
> >     TYPES = (
> >         ('c', 'Land'),
> >         ('p', 'Provincie'),
> >     )
> >     name = models.CharField(max_length=200, verbose_name="Provincie/
> > Land")
> >     type = models.CharField(max_length=1, choices=TYPES, default='c')
>
> >     def __unicode__(self):
> >         return self.name
>
> >     class Meta:
> >         ordering = ('-type', 'name',)
> >         verbose_name = 'Provincie/Land'
> >         verbose_name_plural = 'Provincies/Landen'
>
> > For the record, I am using django trunk revision 12295 .
>
> > - Wim
>
> The Django 
> documentation:http://docs.djangoproject.com/en/dev/ref/models/options/#ordering
> mentions that ... "Regardless of how many fields are in ordering, the
> admin site uses only the first field."
>
> """
> Minor observation:  shouldn't the format be
>     ordering = [-type', 'name',]
> """
>
> Derek

-- 
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.

Reply via email to