I want to extend the User model. I followed the steps mentioned in this doc. I made a new app extended_user whose models.py reads as :
from django.db import models
from oscar.apps.customer.abstract_models import AbstractUser
from django.utils.translation import ugettext_lazy as _
class User(AbstractUser):
nickname = models.CharField(_("nick_name"), max_length=50, null=True, blank=True)
def get_full_name(self):
full_name = '%s %s' % (self.last_name.upper(), self.first_name)
return full_name.strip()In settings.py I mention
AUTH_USER_MODEL = "extended_user.User"I make and run migrations. In profile view I can see nickname field but in Profile Edit view I don't. What do I have to do to see the newly added field in the Profile Edit form ?
class ProfileUpdateView(PageTitleMixin, generic.FormView): form_class = ProfileFormmanage.py oscar_fork_app customer apps
class ProfileForm(UserForm):
class Meta:
model = User
fields = existing_user_fields(['first_name', 'last_name', 'musician', 'email'])
Ashia,
>Anyone using a custom user should override UserForm not UserProfileForm.
Thanks for pointing this out. I have made the correction in code (forms.py, see below), and everything looks OK. Your expertise is much appreciated :-)
Cheers.