replace User by get_user_model
This commit is contained in:
parent
81e9a4b8d2
commit
c8483ca7fb
2 changed files with 19 additions and 2 deletions
|
@ -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.utils.translation import ugettext_lazy as _
|
||||||
from django.core.validators import RegexValidator
|
from django.core.validators import RegexValidator
|
||||||
from django.core.exceptions import FieldError
|
from django.core.exceptions import FieldError
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
class Event(models.Model):
|
class Event(models.Model):
|
||||||
title = models.CharField(
|
title = models.CharField(
|
||||||
|
|
|
@ -1,2 +1,17 @@
|
||||||
from django.db import models
|
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")
|
||||||
|
|
Loading…
Reference in a new issue