Advertisement
Korotkodul

models.py

May 26th, 2022
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 9.08 KB | None | 0 0
  1.  
  2.  
  3. # Create your models here.
  4. # Python code to demonstrate SQL to fetch data.
  5.  
  6. # importing the module
  7. import sqlite3
  8.  
  9. from django.db import models
  10.  
  11.  
  12.  
  13.  
  14. class AdditionalEntranceExaminations(models.Model):
  15.     additional_entrance_examinations_key = models.IntegerField(primary_key=True)
  16.     department_key = models.ForeignKey('DepartmentMain', models.DO_NOTHING, db_column='department_key')
  17.     subject = models.ForeignKey('Subject', models.DO_NOTHING)
  18.     student = models.ForeignKey('Student', models.DO_NOTHING)
  19.     date = models.DateField(blank=True, null=True)
  20.     goals = models.IntegerField(blank=True, null=True)
  21.     result = models.IntegerField(blank=True, null=True)
  22.     is_active = models.IntegerField(blank=True, null=True)
  23.  
  24.     class Meta:
  25.         managed = False
  26.         db_table = 'additional_entrance_examinations'
  27.  
  28.  
  29. class AuthGroup(models.Model):
  30.     name = models.CharField(unique=True, max_length=150)
  31.  
  32.     class Meta:
  33.         managed = False
  34.         db_table = 'auth_group'
  35.  
  36.  
  37. class AuthGroupPermissions(models.Model):
  38.     id = models.BigAutoField(primary_key=True)
  39.     group = models.ForeignKey(AuthGroup, models.DO_NOTHING)
  40.     permission = models.ForeignKey('AuthPermission', models.DO_NOTHING)
  41.  
  42.     class Meta:
  43.         managed = False
  44.         db_table = 'auth_group_permissions'
  45.         unique_together = (('group', 'permission'),)
  46.  
  47.  
  48. class AuthPermission(models.Model):
  49.     name = models.CharField(max_length=255)
  50.     content_type = models.ForeignKey('DjangoContentType', models.DO_NOTHING)
  51.     codename = models.CharField(max_length=100)
  52.  
  53.     class Meta:
  54.         managed = False
  55.         db_table = 'auth_permission'
  56.         unique_together = (('content_type', 'codename'),)
  57.  
  58.  
  59. class AuthUser(models.Model):
  60.     password = models.CharField(max_length=128)
  61.     last_login = models.DateTimeField(blank=True, null=True)
  62.     is_superuser = models.IntegerField()
  63.     username = models.CharField(unique=True, max_length=150)
  64.     first_name = models.CharField(max_length=150)
  65.     last_name = models.CharField(max_length=150)
  66.     email = models.CharField(max_length=254)
  67.     is_staff = models.IntegerField()
  68.     is_active = models.IntegerField()
  69.     date_joined = models.DateTimeField()
  70.  
  71.     class Meta:
  72.         managed = False
  73.         db_table = 'auth_user'
  74.  
  75.  
  76. class AuthUserGroups(models.Model):
  77.     id = models.BigAutoField(primary_key=True)
  78.     user = models.ForeignKey(AuthUser, models.DO_NOTHING)
  79.     group = models.ForeignKey(AuthGroup, models.DO_NOTHING)
  80.  
  81.     class Meta:
  82.         managed = False
  83.         db_table = 'auth_user_groups'
  84.         unique_together = (('user', 'group'),)
  85.  
  86.  
  87. class AuthUserUserPermissions(models.Model):
  88.     id = models.BigAutoField(primary_key=True)
  89.     user = models.ForeignKey(AuthUser, models.DO_NOTHING)
  90.     permission = models.ForeignKey(AuthPermission, models.DO_NOTHING)
  91.  
  92.     class Meta:
  93.         managed = False
  94.         db_table = 'auth_user_user_permissions'
  95.         unique_together = (('user', 'permission'),)
  96.  
  97.  
  98. class Competitions(models.Model):
  99.     competition_id = models.IntegerField(primary_key=True)
  100.     name = models.TextField(blank=True, null=True)
  101.     url = models.TextField(blank=True, null=True)
  102.  
  103.     class Meta:
  104.         managed = False
  105.         db_table = 'competitions'
  106.  
  107.  
  108. class Department(models.Model):
  109.     department_id = models.IntegerField(primary_key=True)
  110.     department_name = models.TextField(blank=True, null=True)
  111.     info = models.TextField(blank=True, null=True)
  112.  
  113.     class Meta:
  114.         managed = False
  115.         db_table = 'department'
  116.  
  117.  
  118. class DepartmentMain(models.Model):
  119.     key = models.IntegerField(primary_key=True)
  120.     department = models.ForeignKey(Department, models.DO_NOTHING)
  121.     faculty = models.ForeignKey('Faculty', models.DO_NOTHING)
  122.     recommendation = models.TextField(blank=True, null=True)
  123.     info = models.TextField(blank=True, null=True)
  124.  
  125.     class Meta:
  126.         managed = False
  127.         db_table = 'department_main'
  128.  
  129.  
  130. class DjangoAdminLog(models.Model):
  131.     action_time = models.DateTimeField()
  132.     object_id = models.TextField(blank=True, null=True)
  133.     object_repr = models.CharField(max_length=200)
  134.     action_flag = models.PositiveSmallIntegerField()
  135.     change_message = models.TextField()
  136.     content_type = models.ForeignKey('DjangoContentType', models.DO_NOTHING, blank=True, null=True)
  137.     user = models.ForeignKey(AuthUser, models.DO_NOTHING)
  138.  
  139.     class Meta:
  140.         managed = False
  141.         db_table = 'django_admin_log'
  142.  
  143.  
  144.         managed = False
  145.         db_table = 'django_migrations'
  146.  
  147.  
  148.     session_data = models.TextField()
  149.     expire_date = models.DateTimeField()
  150.  
  151.     class Meta:
  152.         managed = False
  153.         db_table = 'django_session'
  154.  
  155.  
  156. class Faculty(models.Model):
  157.     faculty_id = models.IntegerField(primary_key=True)
  158.     faculty = models.TextField(blank=True, null=True)
  159.     university = models.ForeignKey('University', models.DO_NOTHING)
  160.  
  161.     class Meta:
  162.         managed = False
  163.         db_table = 'faculty'
  164.  
  165.  
  166. class Level(models.Model):
  167.     level_id = models.IntegerField(primary_key=True)
  168.     level = models.IntegerField()
  169.  
  170.     class Meta:
  171.         managed = False
  172.         db_table = 'level'
  173.  
  174.  
  175. class MainOlympiads(models.Model):
  176.     olympiad_id = models.IntegerField(primary_key=True)
  177.     level = models.ForeignKey(Level, models.DO_NOTHING, blank=True, null=True)
  178.     competition = models.ForeignKey(Competitions, models.DO_NOTHING)
  179.     subject = models.ForeignKey('Subject', models.DO_NOTHING)
  180.     year = models.ForeignKey('Year', models.DO_NOTHING)
  181.     number = models.IntegerField()
  182.  
  183.     class Meta:
  184.         managed = False
  185.         db_table = 'main_olympiads'
  186.  
  187.  
  188. class OlympiadResultKeys(models.Model):
  189.     grade = models.IntegerField(blank=True, null=True)
  190.     is_winner = models.IntegerField()
  191.     is_prize_winner = models.IntegerField()
  192.  
  193.     class Meta:
  194.         managed = False
  195.         db_table = 'olympiad_result_keys'
  196.  
  197.  
  198. class OlympiadsChosen(models.Model):
  199.     olympiads_chosen_key = models.IntegerField(primary_key=True)
  200.     olympiads = models.ForeignKey(MainOlympiads, models.DO_NOTHING)
  201.     student = models.ForeignKey('Student', models.DO_NOTHING)
  202.     date = models.DateField()
  203.     goals = models.ForeignKey(OlympiadResultKeys, models.DO_NOTHING, db_column='goals')
  204.     result = models.ForeignKey(OlympiadResultKeys, models.DO_NOTHING, db_column='result')
  205.     is_active = models.IntegerField(blank=True, null=True)
  206.  
  207.     class Meta:
  208.         managed = False
  209.         db_table = 'olympiads_chosen'
  210.  
  211.  
  212. class Student(models.Model):
  213.     student_id = models.IntegerField(primary_key=True)
  214.     name = models.TextField(blank=True, null=True)
  215.     grade = models.IntegerField(blank=True, null=True)
  216.  
  217.     class Meta:
  218.         managed = False
  219.         db_table = 'student'
  220.  
  221.  
  222. class Subject(models.Model):
  223.     subject_id = models.IntegerField(primary_key=True)
  224.     subject = models.TextField(blank=True, null=True)
  225.  
  226.     class Meta:
  227.         managed = False
  228.         db_table = 'subject'
  229.  
  230.  
  231. class University(models.Model):
  232.     university_id = models.IntegerField(primary_key=True)
  233.     university = models.TextField(blank=True, null=True)
  234.     url = models.TextField(blank=True, null=True)
  235.  
  236.     class Meta:
  237.         managed = False
  238.         db_table = 'university'
  239.  
  240.  
  241. class UniversityChosen(models.Model):
  242.     university_chosen_key = models.IntegerField(primary_key=True)
  243.     date = models.DateField()
  244.     student = models.ForeignKey(Student, models.DO_NOTHING)
  245.     department_key = models.ForeignKey(DepartmentMain, models.DO_NOTHING, db_column='department_key')
  246.     extra_points = models.IntegerField(blank=True, null=True)
  247.     is_active = models.IntegerField(blank=True, null=True)
  248.  
  249.     class Meta:
  250.         managed = False
  251.         db_table = 'university_chosen'
  252.  
  253.  
  254. class Use(models.Model):
  255.     use_key = models.IntegerField(db_column='USE_key', primary_key=True)  # Field name made lowercase.
  256.     subject = models.ForeignKey(Subject, models.DO_NOTHING)
  257.     subject_coefficient = models.IntegerField(blank=True, null=True)
  258.     student = models.ForeignKey(Student, models.DO_NOTHING)
  259.     date = models.DateField(blank=True, null=True)
  260.     goals = models.IntegerField(blank=True, null=True)
  261.     result = models.IntegerField(blank=True, null=True)
  262.     is_active = models.IntegerField(blank=True, null=True)
  263.  
  264.     class Meta:
  265.         managed = False
  266.         db_table = 'use'
  267.  
  268.  
  269. class Vsosh(models.Model):
  270.     vsosh_id = models.IntegerField(primary_key=True)
  271.     subject = models.ForeignKey(Subject, models.DO_NOTHING)
  272.     student = models.ForeignKey(Student, models.DO_NOTHING)
  273.     date = models.DateField()
  274.     goals = models.ForeignKey(OlympiadResultKeys, models.DO_NOTHING, db_column='goals')
  275.     result = models.ForeignKey(OlympiadResultKeys, models.DO_NOTHING, db_column='result')
  276.     is_active = models.IntegerField(blank=True, null=True)
  277.  
  278.     class Meta:
  279.         managed = False
  280.         db_table = 'vsosh'
  281.  
  282.  
  283. class Year(models.Model):
  284.     year_id = models.IntegerField(primary_key=True)
  285.     year = models.TextField(blank=True, null=True)
  286.  
  287.     class Meta:
  288.         managed = False
  289.         db_table = 'year'
  290.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement