Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django.db import models
- from django.urls import reverse
- # Create your models here.
- class University(models.Model):
- id = models.IntegerField("Id", primary_key= True)
- short_name = models.CharField("Сокращенное название", max_length=50)
- full_name = models.TextField("Полное название", max_length=250)
- address = models.CharField("Адрес", max_length=150)
- phone = models.CharField("Телефон", max_length=50)
- url = models.URLField(max_length=150, unique=True,default="")
- country = models.CharField("Страна", max_length=50, default="")
- def __str__(self):
- return self.short_name
- def get_absolute_url(self):
- return reverse("univer_info", kwargs={"pk": self.id})
- class Meta:
- verbose_name = "Университет"
- verbose_name_plural = "Университеты"
- class olympiads(models.Model):
- id = models.IntegerField("олмипиада", primary_key=True)
- name = models.TextField("Название", default="")
- url = models.URLField(max_length=150, unique=True,default="")
- def __str__(self):
- return self.name
- class Meta:
- verbose_name = "Олимпиада"
- verbose_name_plural = "Олимпиады"
- class subjects(models.Model):
- id = models.IntegerField(primary_key=True)
- name = models.TextField()
- def __str__(self):
- return self.name
- class Meta:
- verbose_name = "УПредмет"
- verbose_name_plural = "Предметы"
- class year(models.Model):
- id = models.IntegerField(primary_key=True)
- num_of_year = models.IntegerField(default=0)
- number_of_order = models.TextField()
- def __str__(self):
- return self.num_of_year
- class Meta:
- verbose_name = "Год"
- verbose_name_plural = "Годы"
- class ol_number_int_list(models.Model):
- id_year = models.ForeignKey(year,on_delete=models.CASCADE)
- id_ol = models.ForeignKey(olympiads,on_delete=models.CASCADE)
- number_in_list = models.IntegerField()
- class Meta:
- verbose_name = "номер олимпиады в перечне рсош"
- verbose_name_plural = "номера олимпиад в перечне рсош"
- class organizer(models.Model):
- id = models.IntegerField(primary_key=True)
- name = models.TextField()
- def __str__(self):
- return self.name
- class Meta:
- verbose_name = "организатор"
- verbose_name_plural = "организаторы"
- class ol_organizer(models.Model):
- id_year = models.ForeignKey(year, on_delete=models.CASCADE, default="")
- id_ol = models.ForeignKey(olympiads,on_delete=models.CASCADE, default="")
- id_org = models.ForeignKey(organizer,on_delete=models.CASCADE, default="")
- class Meta:
- verbose_name = "организатор олимпиады"
- verbose_name_plural = "организаторы олимпиад"
- class profile(models.Model):
- id = models.IntegerField(primary_key=True)
- name = models.TextField()
- def __str__(self):
- return self.name
- class Meta:
- verbose_name = "профиль"
- verbose_name_plural = "профили"
- class ol_info(models.Model): #по предмету можем узнать все профили ЭТОЙ олимпиады, которые соответствуют ДЛЯ ЭТОЙ олимпиады ЭТОМУ предмету
- id_year = models.ForeignKey(year, on_delete=models.CASCADE)
- id_ol = models.ForeignKey(olympiads,on_delete=models.CASCADE)
- id_subj = models.ForeignKey(subjects,on_delete=models.CASCADE)
- id_prof = models.ForeignKey(profile, on_delete=models.CASCADE)
- level = models.IntegerField(default="")
- class Meta:
- verbose_name = "год, предмет, профиль, уровень олимпиады"
Add Comment
Please, Sign In to add comment