Re: Django 1.0.2 ordering fireign keys

2009-07-23 Thread Rajesh D

> Lets say I have two models Street and House, related by a foreign key
> thus:
>
> class House(models.Model):
>     house_number =  models.CharField(max_length=16)
>     street = models.ForeignKey(Street)
>
> In the admin area, the Change House page displays a list widget by
> which to select the street.  I need them to be listed in alphabetical
> order.
>
> How should a newbie cause this to happen?

Add the appropriate 'ordering' Meta field to your Street model.

http://docs.djangoproject.com/en/dev//ref/models/options/#ordering

-RD

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



Django 1.0.2 ordering fireign keys

2009-07-22 Thread adelaide_mike

Hi
Lets say I have two models Street and House, related by a foreign key
thus:

class House(models.Model):
house_number =  models.CharField(max_length=16)
street = models.ForeignKey(Street)

In the admin area, the Change House page displays a list widget by
which to select the street.  I need them to be listed in alphabetical
order.

How should a newbie cause this to happen?  TIA for yor sual helpful
response.

Mike
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---