@register.simple_tag
def get_brand():
'''
set brand name instead of 'Главная' in the navbar
'''
try:
user_profile = UserProfile.objects.get(user_id=1)
except UserProfile.DoesNotExist:
user_profile = UserProfile.objects.create(user_id=1)
return user_profile.brand
get_or_create
USERNAME_FIELD = 'email'
class User(AbstractUser):
"""User model."""
username = None # Можете выпилить username если он вам не нужен
email = models.EmailField(_('email address'), unique=True)
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = []
AUTH_USER_MODEL = 'YOUR_APP.User'