It actually like this, sorry...to trigger happy today :)

class Composer(models.Model):
    name = models.CharField(max_length=20)

    class Meta:
        ordering = ['name']

class Chart(models.Model):
    composer = models.ForeignKey(Composer)



-Alen Ribic


On May 6, 9:20 pm, Alen Ribic <[EMAIL PROTECTED]> wrote:
> *correction:
>
> Need probably a comma at the end of the order tuple unless you use a
> list instead:
>
> class Chart(models.Model):
>     composer = models.ForeignKey(Composer)
>
>     class Meta:
>         ordering = ('composer',)
>
> --Alen Ribic
>
> On May 6, 9:17 pm, Alen Ribic <[EMAIL PROTECTED]> wrote:
>
> > You should be able to do it like so:
>
> > class Chart(models.Model):
> >     composer = models.ForeignKey(Composer)
>
> >     class Meta:
> >         ordering = ('composer')
>
> > Regards,
> > -Alen Ribic
>
> > PS check out:http://www.djangoproject.com/documentation/models/ordering/
>
> > On May 6, 8:48 pm, "Greg Lindstrom" <[EMAIL PROTECTED]> wrote:
>
> > > Hello-
>
> > > Is there a way to sort the drop down select boxes on the Admin site?
> > > I have a class, Chart, which represents a piece of music for my brass
> > > quintet library.  Each charts has a composer, an arranger and a
> > > publisher which are represented by the Composer, Arranger, and
> > > Publisher classes.  When I add a new chart to the database I click on
> > > the composer drop down to see if they are already listed in the db,
> > > but it appears they are ordered as they are entered.  I tried placing
> > > a sort_order in the Composer class, but that didn't seem to do it.
>
> > > Thanks,
> > > --greg
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to