OK, here is the question.
class UserForm(forms.ModelForm):
class Meta:
model = User
fields = ('team', 'related_projects')
The models.pyclass Useris defined as follows:
class User (models.Model):
team = models.ForeignKey(Team, verbose_name = _('team'))
related_projects = models.ManyToManyField(Project, blank = True)
Both teamand related_projectsare displayed as a drop-down list. Values are all existing teams in the system and all existing projects in the system. Everything is fine, but they are only ordered by primary key, and I would like them to be ordered in alphabetical order. Where should I specify the order for the values in the drop down list?
source
share