> class Pubblicazioni(models.Model): > anno = models.DateField(blank=True, null=True,default=datetime.date.today) > autori = models.CharField(max_length=500) > titolo = models.CharField(max_length=500) > autori_daf = models.ManyToManyField(User) > > I need to ordering (by the User.last_name) the field 'autori_daf' > when it is displayed at the form generated by > > class PubblicazioniForm(ModelForm): > class Meta: > model = Pubblicazioni
You can explicitly provide a queryset to the appropriate field in your PubblicazioniForm: class PubblicazioniForm(ModelForm): autori_daf = forms.ModelMultipleChoiceField(queryset=User.objects.all().order_by('last_name')) class Meta: model = Pubblicazioni Regards Scott -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.