I'd like to save and access custom field of allauth. After I save the form and try to access the data but it's empty. {{ user.school }} I only add forms.py. Do I need to add on models.py too?
-> I change the models but still I can't access the school filed ㅜㅜ)
forms.py from django.contrib.auth import get_user_model from django import forms
SCHOOL = (
('', 'Select your school...'),
('ucla.edu', 'UCLA'),
('berkeley.edu', 'Berkeley'),
)
class SignupForm(forms.Form):
school = forms.ChoiceField(choices=SCHOOL, required=True)
def signup(self, request, user):
user.school = self.cleaned_data['school']
user.save()
models.py
class UserProfile(models.Model):
user = models.OneToOneField(User)
school = models.CharField(max_length=128)
def __unicode__(self):
return self.user.username
Thanks in advance!