views:

56

answers:

1

Hi all,

I have a task list, with ability to assign users. So i have foreignkey to User model in the database. However, the default display is username in the dropdown menu, i would like to display full name (first last) instead of the username. If the foreignkey is pointing to one of my own classes, i can just change the str function in the model, but User is a django authentication model, so i can't easily change it directly right?

Anyone have any idea how to accomplish this?

Thanks a lot!

A: 

You can specify the list of choices in your form:

USERS = [(user, user.get_full_name()) for user in User.objects.all()]

class YourForm(forms.Form):
    users = forms.ChoiceField(choices=USERS)
Chris Lawlor