1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2025-02-06 12:13:01 +00:00
med/users/models.py

47 lines
1.2 KiB
Python
Raw Normal View History

2019-08-02 14:57:53 +02:00
# -*- mode: python; coding: utf-8 -*-
# Copyright (C) 2017-2019 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
2019-08-08 12:16:40 +02:00
from django.contrib.auth.models import AbstractUser
2019-08-02 14:57:53 +02:00
from django.db import models
from django.utils import timezone
2019-08-02 14:57:53 +02:00
from django.utils.translation import gettext_lazy as _
2019-08-09 23:17:55 +02:00
from med.settings import MAX_EMPRUNT
2019-08-08 12:16:40 +02:00
class User(AbstractUser):
telephone = models.CharField(
verbose_name=_('phone number'),
max_length=15,
blank=True,
2019-08-02 21:35:30 +02:00
)
2019-08-08 12:16:40 +02:00
address = models.CharField(
verbose_name=_('address'),
max_length=255,
blank=True,
2019-08-02 18:37:54 +02:00
)
2019-08-08 12:16:40 +02:00
maxemprunt = models.IntegerField(
verbose_name=_('maximum borrowed'),
2019-08-08 15:35:25 +02:00
help_text=_('Maximal amount of simultaneous borrowed item '
'authorized.'),
2019-08-08 12:16:40 +02:00
default=MAX_EMPRUNT,
)
comment = models.CharField(
verbose_name=_('comment'),
help_text=_('Promotion...'),
max_length=255,
blank=True,
2019-08-02 18:37:54 +02:00
)
date_joined = models.DateTimeField(
_('date joined'),
default=timezone.now,
null=True,
)
2019-08-08 12:16:40 +02:00
REQUIRED_FIELDS = ['first_name', 'last_name', 'email']
@property
2019-08-10 16:22:04 +02:00
def is_member(self):
# FIXME Use NK20
return True