Answers
你可以使用forms的ModelChoiceField。很方便的。举个不完整的例子:
forms.py
from django import forms
class DepartmentAddForm(forms.Form):
name = forms.CharField(label=_(u"Department Name"),max_length=125)
director = forms.ModelChoiceField(label=_(u"Director"),queryset=Users.objects.all())
希望有帮助。
憨得有个性
answered 11 years, 3 months ago