Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ReceivingStaff(models.Model):
- """График приёмов вызова"""
- days_of_the_week = models.ForeignKey(Week, verbose_name='График Приёмов вызова', on_delete=models.CASCADE, null=True)
- start_work = models.TimeField('Начала работы', blank=True, null=True)
- end_work = models.TimeField('Конец рабочего дня', blank=True, null=True)
- staff = models.ForeignKey('Staff', verbose_name='Сотрудник', blank=True, null=False)
- class Meta:
- verbose_name = 'Прием вызовов'
- verbose_name_plural = "Прием вызова"
- db_table = 'receivingstaff'
- def __str__(self):
- if self.days_of_the_week == None:
- return ''
- else:
- return str(self.days_of_the_week) + ' - ' + str(self.staff.name) if self.staff.name else ' --- '
- class Staff(models.Model):
- surname = models.CharField('Фамилия', max_length=32, db_index=True)
- name = models.CharField('Имя', max_length=32)
- patronymic = models.CharField('Отчество', max_length=32)
- date_of_birth = models.DateField('Дата рождения', blank=False)
- position = models.CharField('Должность', max_length = 150, blank=True)
- specialty = models.CharField('Специальность', max_length = 150, blank=True)
- region = models.CharField('Регион/Область',null=True,blank=True, max_length=150)
- town = models.ForeignKey(Town, verbose_name="Город",null=True, blank=True, on_delete=models.SET_NULL)
- district = models.CharField('Район',null=True,blank=True, max_length=150)
- building = models.CharField('Дом №', max_length=100, blank=True, null=True, default='')
- street = models.CharField('Улица',max_length=100, null=True, blank=True)
- flat = models.CharField('Квартира №', blank=True,null=True, max_length=10)
- phone_regex = RegexValidator(regex=r'^\+?1?\d{9,15}$')
- phone = models.CharField('Контактный номер телефона', validators=[phone_regex], max_length=17, blank=True,db_index=True)
- photo = models.ImageField(upload_to='staff/%Y/%m/%d', blank=True)
- date_of_employment = models.DateField('Дата трудоустройства', blank=False)
- date_of_dismissal = models.DateField('Дата увольнения', blank=False)
- present = models.BooleanField('Присутствует', default = False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement