but Country class doesn't have such field 'tour' ! ;/ Alex Koshelev пишет: > class Country(models.Model): > #... > class Meta: > ordering = ('name','tour',) > > On 23 сент, 03:47, Oleg Korsak <[EMAIL PROTECTED]> > wrote: >> Hello. I have such models: >> >> class Country(models.Model): >> name = models.CharField(_('name'), maxlength=32) >> >> def __unicode__(self): >> return self.name >> >> class Meta: >> verbose_name = _('country') >> verbose_name_plural = _('countries') >> ordering = ('name',) >> >> class Admin: >> pass >> >> class Tour(models.Model): >> id = models.AutoField(primary_key=True) >> country = models.ForeignKey(Country) >> name = models.CharField(_('name'), maxlength=64) >> user = models.ForeignKey(User,blank=True,null=True,default=None) >> >> def __unicode__(self): >> return self.name >> >> class Meta: >> verbose_name = _('tour host') >> verbose_name_plural = _('tour hosts') >> ordering = ('name',) >> >> class Admin: >> pass >> >> ---------------- >> The problem is that I want to build such list (ordered by country name >> and then tour name): >> >> Angola Tour1 >> Angola Tour2 >> Angola Tour3 >> Germany Tour1 >> Germany Tour2 >> USA Tour1 >> >> Right now I have such commands: >> >> tour_paginator = ObjectPaginator(Tour.objects.all(), 20) >> tours = tour_paginator.get_page(page - 1) >> >> But they get that list ordered only by tour name: >> >> Angola Tour1 >> Germany Tour1 >> USA Tour1 >> Angola Tour2 >> Germany Tour2 >> Angola Tour3 >> >> How can I resolve my problem? >> Thanks. >> >> signature.asc >> 1KЗагрузить > > > --~--~---------~--~----~------------~-------~--~----~ > 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 > -~----------~----~----~----~------~----~------~--~--- > >
signature.asc
Description: OpenPGP digital signature