Django newbie wants admin list to be ordered by foreignkey names.

I understand from googling that this is a known problem, and has
apparently been fixed in the newforms admin branch.  (Do I understand
correctly?)

Questions:
1. This is a new project.  (On the other hand, I want to take it all
the way to production.) Should I just switch to the newforms admin
branch now?

2. If I want some other improvements from some other non-trunk
branches, I assume I cannot mix and match non-trunk branches.
Correct? If not, the next question may not matter.

3. Is there anything that I can easily do, without switching to a non-
trunk branch, to sort the admin list by foreignkeys now?

Here are my models:

class Producer(models.Model):
    name = models.CharField(max_length=64)
    def __unicode__(self):
        return self.name
    class Meta:
        ordering = ('name',)
    class Admin:
        list_display = ('name',)
        ordering = ('name',)

class Product(models.Model):
    name = models.CharField(max_length=64)
    def __unicode__(self):
        return self.name
    class Meta:
        ordering = ('name',)
    class Admin:
        list_display = ('name',)
        ordering = ('name',)

class Avail(models.Model):
    producer = models.ForeignKey(Producer)
    product = models.ForeignKey(Product)
    week = models.DateField()
    quantity = models.IntegerField()
    class Admin:
        list_display = ('week', 'product', 'producer', 'quantity')
        ordering = ('week', 'orders_product.name',
'orders_producer.name',)

Avail is the list I am trying to sort by the product and producer
names.  The ordering statement is my most recent attempt to get them
sorted properly.  I've tried a few others.

Suggestions? Thanks.
--~--~---------~--~----~------------~-------~--~----~
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