I have used self.fields to get all the users full names instead of just user names, no开发者_Go百科w I would like to just add an empty field as the first choice...
Currently.
def __init__(self, user, *args, **kwargs):
super(TrophiesForm, self).__init__(*args, **kwargs)
self.fields['outfitter'].choices = [(user.pk, user.get_full_name()) for user in users]
self.fields['outfitter'].choices = [('', '')] + [(user.pk, user.get_full_name()) for user in users]
精彩评论