Skip to content

Instantly share code, notes, and snippets.

@mentix02
Last active August 26, 2020 13:36
Show Gist options
  • Save mentix02/76c4c24d41792ce1876d3229478c40a5 to your computer and use it in GitHub Desktop.
Save mentix02/76c4c24d41792ce1876d3229478c40a5 to your computer and use it in GitHub Desktop.
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.utils.translation import gettext_lazy as _
class User(AbstractUser):
private = models.BooleanField(default=False)
email = models.EmailField(_('email address'), unique=True)
bio = models.CharField(
max_length=250, null=True, blank=True, help_text='About the user.'
)
picture = models.ImageField(
null=True,
blank=True,
default='default.png',
upload_to='profile_pictures',
verbose_name=_('profile picture'),
)
REQUIRED_FIELDS = ['email', 'password']
def __str__(self) -> str:
return self.username
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment