Faces/UserStatus/models.py
2024-04-01 15:33:40 +06:00

56 lines
2.0 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from django.db import models
from oauth2_provider import settings as oauth2_settings
class MyUser(models.Model):
def photo_upload(instance, filename):
return f'passport/{instance.first_name}-{instance.last_name}/{filename}'
GENDER_CHOICES = (
('Мужской', 'Мужской'),
('Женский', 'Женский'),
)
email = models.EmailField(unique=True)
gender = models.CharField(max_length=10, choices=GENDER_CHOICES, blank=True, null=True, verbose_name='Пол')
date = models.DateField(null=True, blank=True, verbose_name='Дата рождения')
phone_number = models.CharField(max_length=15, blank=True, null=True, unique=True, verbose_name='Номер телефона')
image = models.ImageField(upload_to='images', blank=True, verbose_name='Изображение профиля')
face_image = models.ImageField(upload_to=photo_upload, blank=True, verbose_name='Переднее изображение паспорта')
back_image = models.ImageField(upload_to=photo_upload, blank=True, verbose_name='Заднее изображение паспорта')
STATUS_CHOICES = (
('Верифицирован', 'Верифицирован'),
('Не верифицирован', 'Не верифицирован'),
('На верификацию', 'На верификацию'),
('Верификация отклонена', 'Верификация отклонена'),
)
status = models.CharField(max_length=30, default='Не верифицирован', choices=STATUS_CHOICES, blank=True, null=True, verbose_name='Статус')
class Meta:
db_table = 'backend_myuser'
def __str__(self):
return self.email
class Token000000(models.Model):
token = models.CharField(max_length=255, unique=True, verbose_name='key')
user_id = models.IntegerField(unique=True, verbose_name='user_id')
class Meta:
db_table = 'authtoken_token'
def __str__(self):
return self.token