8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-23 11:53:12 +00:00

Fix: user.models.User.auto_uid can't be static

This commit is contained in:
Maël Kervella 2018-04-15 10:51:05 +00:00
parent 0065e2e0f5
commit 915d5e8931
3 changed files with 6 additions and 9 deletions

View file

@ -37,6 +37,6 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='user',
name='uid_number',
field=models.IntegerField(unique=True, default=users.models.User.auto_uid),
field=models.IntegerField(unique=True, default=users.models.get_fresh_user_uid),
),
]

View file

@ -32,6 +32,6 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='user',
name='uid_number',
field=models.PositiveIntegerField(default=users.models.User.auto_uid, unique=True),
field=models.PositiveIntegerField(default=users.models.get_fresh_user_uid, unique=True),
),
]

View file

@ -187,12 +187,6 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
(2, 'STATE_ARCHIVE'),
)
# TODO : Use only one of auto_uid and get_fresh_user_uid
@staticmethod
def auto_uid():
"""Renvoie un uid libre"""
return get_fresh_user_uid()
surname = models.CharField(max_length=255)
pseudo = models.CharField(
max_length=32,
@ -222,7 +216,10 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
state = models.IntegerField(choices=STATES, default=STATE_ACTIVE)
registered = models.DateTimeField(auto_now_add=True)
telephone = models.CharField(max_length=15, blank=True, null=True)
uid_number = models.PositiveIntegerField(default=auto_uid, unique=True)
uid_number = models.PositiveIntegerField(
default=get_fresh_user_uid,
unique=True
)
rezo_rez_uid = models.PositiveIntegerField(
unique=True,
blank=True,