replace User by get_user_model

This commit is contained in:
Qwann 2017-07-18 17:46:00 +02:00
parent 81e9a4b8d2
commit c8483ca7fb
2 changed files with 19 additions and 2 deletions

View file

@ -1,9 +1,11 @@
from django.contrib.auth.models import User
from django.contrib.auth import get_user_model
from django.utils.translation import ugettext_lazy as _
from django.core.validators import RegexValidator
from django.core.exceptions import FieldError
from django.db import models
User = get_user_model()
class Event(models.Model):
title = models.CharField(

View file

@ -1,2 +1,17 @@
from django.db import models
from django.contrib.auth.models import User
from django.contrib.auth.models import AbstractUser, UserManager
from django.utils.translation import ugettext_lazy as _
class User(AbstractUser):
phone = models.CharField(
_('numéro de téléphone'),
max_length=20,
blank=True,
)
objects = UserManager()
class Meta:
verbose_name = _("utilisateur")
verbose_name_plural = _("utilisateurs")