From c8483ca7fb08b812b779c4183de2334414c44bae Mon Sep 17 00:00:00 2001 From: Qwann Date: Tue, 18 Jul 2017 17:46:00 +0200 Subject: [PATCH] replace User by get_user_model --- event/models.py | 4 +++- users/models.py | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/event/models.py b/event/models.py index aaad757..44f17bb 100644 --- a/event/models.py +++ b/event/models.py @@ -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( diff --git a/users/models.py b/users/models.py index 85206e0..201983c 100644 --- a/users/models.py +++ b/users/models.py @@ -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")