43 lines
1.6 KiB
Python
43 lines
1.6 KiB
Python
from django.db import models
|
|
from django.contrib import admin
|
|
|
|
ALKATOR_CHOICES = (
|
|
(1, "Alkátor"),
|
|
(2, "Alkátor light"),
|
|
(3, "Nealkátor"),
|
|
)
|
|
|
|
ALKATOR_CLASSES = (
|
|
(1, "Jaro 2024"),
|
|
(2, "Podzim 2024"),
|
|
)
|
|
|
|
ALKATOR_CHOICES_DICT = {
|
|
alkator_choice[0]: alkator_choice[1]
|
|
for alkator_choice in ALKATOR_CHOICES
|
|
}
|
|
|
|
ALKATOR_CLASSES_DICT = {
|
|
alkator_class[0]: alkator_class[1]
|
|
for alkator_class in ALKATOR_CLASSES
|
|
}
|
|
|
|
class User(models.Model):
|
|
first_name = models.CharField(max_length=120)
|
|
last_name = models.CharField(max_length=120)
|
|
address = models.CharField(max_length=255, null=True, blank=True)
|
|
email = models.EmailField(max_length=120, null=True, blank=True)
|
|
phone = models.CharField(max_length=120, null=True, blank=True)
|
|
date_of_birth = models.DateField(null=True, blank=True)
|
|
register_date = models.DateTimeField(auto_now=True)
|
|
duration = models.DurationField(null=True, blank=True)
|
|
starting_number = models.IntegerField(null=True, blank=True)
|
|
alkator_category = models.IntegerField(choices=ALKATOR_CHOICES, default=1)
|
|
alkator_class = models.IntegerField(choices=ALKATOR_CLASSES)
|
|
trans_id = models.CharField(null=True, blank=True, max_length=120)
|
|
paid = models.BooleanField(default=False)
|
|
invoice_id = models.IntegerField(null=True, blank=True, unique=True)
|
|
|
|
def __str__(self):
|
|
return f"<User {self.starting_number} {self.first_name} {self.last_name} {self.email} {self.duration} {ALKATOR_CHOICES_DICT[self.alkator_category]} {ALKATOR_CLASSES_DICT[self.alkator_class]} {self.paid}>"
|