Possible bug in Meta ordering in 0.96

2 views
Skip to first unread message

Xan

unread,
Sep 30, 2007, 3:14:08 PM9/30/07
to Django developers
Hi,

In my project, I have this class:

class Centre(models.Model):

[...]

tipus = models.CharField(maxlength=14, choices=TIPUS_CENTRE,
verbose_name="Tipus de centre", default='IES')
nom = models.CharField(maxlength=100, verbose_name="Nom del centre")
[...]

def __str__(self):
return "%s" % self.nom

class Meta:
ordering = ('tipus', 'nom')

class Admin:
pass
list_display = ('nom', 'codi', 'tipus', 'localitat',
'ordre_concurs', 'cp', 'adreca')

Although ordering is ('tipus', 'nom'), django admin interface displays
the Centre objects by 'tipus' but randomly (?) with 'nom'. I don't
know how can I do, because, in shell when I put
> Centre.objects.order_by('tipus', 'nom')

it displays me correctly

So, is it possible bug in 0.96?

Please, if you need my database records, I could pass you in private
communication ("big" database)

Thanks in advance,
Xan.

James Bennett

unread,
Sep 30, 2007, 5:22:03 PM9/30/07
to django-d...@googlegroups.com
On 9/30/07, Xan <xanc...@gmail.com> wrote:
> Although ordering is ('tipus', 'nom'), django admin interface displays
> the Centre objects by 'tipus' but randomly (?) with 'nom'. I don't
> know how can I do, because, in shell when I put
> > Centre.objects.order_by('tipus', 'nom')

Please read the Django documentation:

http://www.djangoproject.com/documentation/model-api/#ordering

> So, is it possible bug in 0.96?

No, read the documentation and it will tell you exactly what you're seeing.


--
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

Xan

unread,
Oct 1, 2007, 2:50:23 PM10/1/07
to Django developers

On Sep 30, 11:22 pm, "James Bennett" <ubernost...@gmail.com> wrote:


> On 9/30/07, Xan <xancor...@gmail.com> wrote:
>
> > Although ordering is ('tipus', 'nom'), django admin interface displays
> > the Centre objects by 'tipus' but randomly (?) with 'nom'. I don't
> > know how can I do, because, in shell when I put
> > > Centre.objects.order_by('tipus', 'nom')
>
> Please read the Django documentation:
>
> http://www.djangoproject.com/documentation/model-api/#ordering
>
> > So, is it possible bug in 0.96?
>
> No, read the documentation and it will tell you exactly what you're seeing.

Oh! yes.

But, is it a bug so?

Thanks,
Xan.

Michael Radziej

unread,
Oct 2, 2007, 3:39:10 AM10/2/07
to django-d...@googlegroups.com
On Mon, Oct 01, Xan wrote:

>
>
>
> On Sep 30, 11:22 pm, "James Bennett" <ubernost...@gmail.com> wrote:
> > On 9/30/07, Xan <xancor...@gmail.com> wrote:
> >
> > > Although ordering is ('tipus', 'nom'), django admin interface displays
> > > the Centre objects by 'tipus' but randomly (?) with 'nom'. I don't
> > > know how can I do, because, in shell when I put
> > > > Centre.objects.order_by('tipus', 'nom')
> >
> > Please read the Django documentation:
> >
> > http://www.djangoproject.com/documentation/model-api/#ordering
> >
> > > So, is it possible bug in 0.96?
> >
> > No, read the documentation and it will tell you exactly what you're seeing.
>
> Oh! yes.
>
> But, is it a bug so?

If it is in the documentation, it is intended behaviour.

Please, direct questions about the useage of Django to django-users, and not
django-developers, which is for developing the Django framework itself. And
that does include bugs unless you're pretty sure that this is a core issue
for Django developers. Which is extremely seldom the case.


Michael


--
noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
Tel +49-911-9352-0 - Fax +49-911-9352-100
http://www.noris.de - The IT-Outsourcing Company

Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel, Hansjochen Klenk -
Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689

Xan

unread,
Oct 2, 2007, 1:09:22 PM10/2/07
to Django developers
Yes. I understand it.
I know that this behaviour is documented, but is it a bug so?. The
strange behaviour of admin, even altough it's documented, is strange.
Why you don't consider it a bug? Is there a ticket of that? Do you
plan to change this (strange) behaviour in next version (svn)? If not,
why?

Thanks,
Xan.


On Oct 2, 9:39 am, Michael Radziej <m...@noris.de> wrote:
> On Mon, Oct 01, Xan wrote:
>
> > On Sep 30, 11:22 pm, "James Bennett" <ubernost...@gmail.com> wrote:
> > > On 9/30/07, Xan <xancor...@gmail.com> wrote:
>
> > > > Although ordering is ('tipus', 'nom'), django admin interface displays
> > > > the Centre objects by 'tipus' but randomly (?) with 'nom'. I don't
> > > > know how can I do, because, in shell when I put
> > > > > Centre.objects.order_by('tipus', 'nom')
>
> > > Please read the Django documentation:
>
> > >http://www.djangoproject.com/documentation/model-api/#ordering
>
> > > > So, is it possible bug in 0.96?
>
> > > No, read the documentation and it will tell you exactly what you're seeing.
>
> > Oh! yes.
>
> > But, is it a bug so?
>
> If it is in the documentation, it is intended behaviour.
>
> Please, direct questions about the useage of Django to django-users, and not
> django-developers, which is for developing the Django framework itself. And
> that does include bugs unless you're pretty sure that this is a core issue
> for Django developers. Which is extremely seldom the case.
>
> Michael
>
> --
> noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -

> Tel +49-911-9352-0 - Fax +49-911-9352-100http://www.noris.de- The IT-Outsourcing Company

Xan

unread,
Oct 2, 2007, 1:09:22 PM10/2/07
to Django developers
Yes. I understand it.
I know that this behaviour is documented, but is it a bug so?. The
strange behaviour of admin, even altough it's documented, is strange.
Why you don't consider it a bug? Is there a ticket of that? Do you
plan to change this (strange) behaviour in next version (svn)? If not,
why?

Thanks,
Xan.


On Oct 2, 9:39 am, Michael Radziej <m...@noris.de> wrote:

> On Mon, Oct 01, Xan wrote:
>
> > On Sep 30, 11:22 pm, "James Bennett" <ubernost...@gmail.com> wrote:
> > > On 9/30/07, Xan <xancor...@gmail.com> wrote:
>
> > > > Although ordering is ('tipus', 'nom'), django admin interface displays
> > > > the Centre objects by 'tipus' but randomly (?) with 'nom'. I don't
> > > > know how can I do, because, in shell when I put
> > > > > Centre.objects.order_by('tipus', 'nom')
>
> > > Please read the Django documentation:
>
> > >http://www.djangoproject.com/documentation/model-api/#ordering
>
> > > > So, is it possible bug in 0.96?
>
> > > No, read the documentation and it will tell you exactly what you're seeing.
>
> > Oh! yes.
>
> > But, is it a bug so?
>
> If it is in the documentation, it is intended behaviour.
>
> Please, direct questions about the useage of Django to django-users, and not
> django-developers, which is for developing the Django framework itself. And
> that does include bugs unless you're pretty sure that this is a core issue
> for Django developers. Which is extremely seldom the case.
>
> Michael
>
> --
> noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -

> Tel +49-911-9352-0 - Fax +49-911-9352-100http://www.noris.de- The IT-Outsourcing Company

James Bennett

unread,
Oct 2, 2007, 1:25:28 PM10/2/07
to django-d...@googlegroups.com
On 10/2/07, Xan <xanc...@gmail.com> wrote:
> I know that this behaviour is documented, but is it a bug so?. The
> strange behaviour of admin, even altough it's documented, is strange.
> Why you don't consider it a bug? Is there a ticket of that? Do you
> plan to change this (strange) behaviour in next version (svn)? If not,
> why?

A "bug" is when software does not behave the way it is supposed to.
The software is supposed to behave this way. Therefore, this is not a
bug.

If you think that it would be a good *enhancement* to add support for
multi-column ordering, that's another issue entirely, but software
behaving as document is not and can not be a "bug".

Karen Tracey

unread,
Oct 2, 2007, 2:49:06 PM10/2/07
to django-d...@googlegroups.com
As James says, it's not a bug.  But I'd agree it seems a little odd, until you look a little more closely at the admin interface.  It allows the user to sort on fields by clicking on column headers.  It gets a little messy to try to combine that feature with multi-field ordering specified in the model, so I'd guess that is why the admin interface only ever pays attention to the first  field listed in "ordering".  That's just my guess though.

Karen

Tai Lee

unread,
Oct 3, 2007, 7:40:52 AM10/3/07
to Django developers
I've implemented multi-column ordering in my own projects, and don't
think it's that tricky to use (in the UI, implementation may be tricky
but not too tricky). I use multi-column ordering all the time in my
apps and most desktop apps, so I'd love to see it built into the
Django admin.

In terms of the UI, I think it's fairly safe to only indicate the
primary column we're sorting by and it's direction as we do now -
sorting by a secondary column without any indication couldn't possibly
be more confusing or cause any breakage when compared to the current
random secondary sorting, and fits with most desktop app UIs.

Those who never even give a second thought to multi-column sorting can
safely continue not knowing that it exists, while others who want it,
or are familiar with it from desktop apps, or simply find it intuitive
to have the current sort maintained as a secondary sort when selecting
a new primary sort, can reap the rewards.

Tai.

Xan

unread,
Oct 3, 2007, 10:46:41 AM10/3/07
to Django developers
Well, so it's not a bug!
But it's an enhancement:: http://code.djangoproject.com/ticket/5673

Thanks a lot,
Xan.

Reply all
Reply to author
Forward
0 new messages