Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django.db import models
- # Create your models here.
- #возьми олимпиады, где только один организатор
- class University(models.Model):
- 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)
- def __str__(self):
- return self.short_name
- class Meta:
- verbose_name = "Университет"
- verbose_name_plural = "Университеты"
- class olympiads(models.Model):
- id = models.IntegerField(primary_key=True)
- name = models.TextField()
- url = models.URLField(max_length=150, unique=True,default="")
- def __str__(self):
- return self.name
- class subjects(models.Model):
- id = models.IntegerField(primary_key=True)
- name = models.TextField()
- def __str__(self):
- return self.name
- 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 ol_level(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)
- level = models.IntegerField()
- 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 organizer(models.Model):
- id = models.IntegerField(primary_key=True)
- name = models.TextField()
- def __str__(self):
- return self.name
- class ol_organizer(models.Model):
- id_ol = models.ForeignKey(olympiads,on_delete=models.CASCADE)
- id_org = models.ForeignKey(organizer,on_delete=models.CASCADE)
- class profile(models.Model):
- id = models.IntegerField(primary_key=True)
- name = models.TextField()
- def __str__(self):
- return self.name
- class ol_subj(models.Model): #по предмету можем узнать все профили ЭТОЙ олимпиады, которые соответствуют ДЛЯ ЭТОЙ олимпиады ЭТОМУ предмету
- id_ol = models.ForeignKey(olympiads,on_delete=models.CASCADE)
- id_subj = models.ForeignKey(subjects,on_delete=models.CASCADE)
- class profile_of_subject(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)
Add Comment
Please, Sign In to add comment