You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wish/utils/models.py

14 lines
486 B
Python

from django.db import models
from django.contrib.auth.models import AbstractUser
# https://docs.djangoproject.com/en/3.1/topics/auth/customizing/#using-a-custom-user-model-when-starting-a-project
class MyUser(AbstractUser):
def __str__(self):
if self.first_name != '' and self.last_name != '':
return f"{self.first_name} {self.last_name}"
# Hack: if a nickname is to be used, it is the first name.
if self.first_name != '':
return self.first_name
return self.username