你可以使用
a ModelChoiceField然后
ProfileForm.__init__动态更改你的选择,例如(假设它已经是ModelChoiceField):
horoscopes = Horoscope.objects.all()self.fields['horoscope'].choices = [(h.pk, h.name) for h in horoscopes]
h.name在本例中将用作选择的标签!

你可以使用
a ModelChoiceField然后
ProfileForm.__init__动态更改你的选择,例如(假设它已经是ModelChoiceField):
horoscopes = Horoscope.objects.all()self.fields['horoscope'].choices = [(h.pk, h.name) for h in horoscopes]
h.name在本例中将用作选择的标签!