Answer the question
In order to leave comments, you need to log in
Error when entering the page, how to solve?
I welcome everyone! There was a problem. When I go to the registration page, django throws an error.
Django suggests that the error is somewhere here:
in views, what django emphasizes is highlighted:
class UserProfileManager(BaseUserManager):
def _create_user(self, username, email, password,
is_superuser, **extra_fields):
now = timezone.now()
if not username:
raise ValueError(_('Имя пользователя должно быть установлено'))
email = self.normalize_email(email)
user = self.model(username=username, email=email,
is_active=True,
is_superuser=is_superuser, last_login=now,
date_joined=now, **extra_fields)
user.set_password(password)
user.save()
return user
def create_user(self, username, email=None, password=None, **extra_fields):
return self._create_user(username, email, password, False,
**extra_fields)
def create_superuser(self, username, email, password, **extra_fields):
return self._create_user(username, email, password, True,
**extra_fields)
def get_user_by_b64username(self, b64username):
try:
return self.get(username=urlsafe_base64_decode(force_text(b64username)))
except:
raise Http404
def get_main_admin(self):
return self.filter(is_superuser=True).order_by('pk')[0]
class UserProfileManager(BaseUserManager):
def _create_user(self, username, email, password,
is_superuser, **extra_fields):
now = timezone.now()
if not username:
raise ValueError(_('Имя пользователя должно быть установлено'))
email = self.normalize_email(email)
user = self.model(username=username, email=email,
is_active=True,
is_superuser=is_superuser, last_login=now,
date_joined=now, **extra_fields)
user.set_password(password)
user.save()
return user
def create_user(self, username, email=None, password=None, **extra_fields):
return self._create_user(username, email, password, False,
**extra_fields)
def create_superuser(self, username, email, password, **extra_fields):
return self._create_user(username, email, password, True,
**extra_fields)
def get_user_by_b64username(self, b64username):
try:
return self.get(username=urlsafe_base64_decode(force_text(b64username)))
except:
raise Http404
def get_main_admin(self):
return self.filter(is_superuser=True).order_by('pk')[0]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question