On Monday 02 April 2007 09:20, TaMeR wrote: > On Mar 31, 7:14 am, Gilhad <[EMAIL PROTECTED]> wrote: > > I have something like this: > > > > class Project(models.Model): > > name = models.CharField(maxlength=10) > > order = models.IntegerField() > > .... > > def __str__(self): return self.name > > > > class Task(models.Model): > > project = models.ForeignKey(Project) > > description = models.CharField(maxlength=100) > > > > Is there a way in Admin, when editing Task, to have the Select field for > > Project sorted by Project.order (or at least by Project.name) instead of > > Project.id? > > > > (The Project.id order looks pretty chaotic, as it reflex the time (id is > > AutoField), when the Project was entered, which is surely not too much > > descriptive, as many related Projects are entered at very different > > times) > > > > -- > > Zdravi > > Gilhad > > [EMAIL PROTECTED] > > How about > > class Meta: > ordering = ['name'] > > More info: > http://www.djangoproject.com/documentation/0.95/model-api/#id5 > > Please post your code when you done. I could use a project module. >
Thank you, that what I needed to know. Problem perfectly solved ;-) -- Zdravi Gilhad [EMAIL PROTECTED] --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---