Skip to content

Instantly share code, notes, and snippets.

@baxeico baxeico/forms.py
Last active Aug 29, 2015

Embed
What would you like to do?
User profile ModelForm with a custom group field
from django import forms
from django.contrib.auth.models import User, Group
class UserProfileForm(forms.ModelForm):
group = forms.ModelChoiceField(queryset=Group.objects.all(),
required=True)
class Meta:
model = User
fields = ['first_name', 'last_name', 'email', 'group']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.