I
I
Iskander Mammadov2017-10-29 17:11:14
Django
Iskander Mammadov, 2017-10-29 17:11:14

How to organize similar structure of models in Django?

Good day!
For study, it is necessary to implement a project on Django on a free topic, I chose a catalog of universities with information about specialties and passing scores.
At the moment I am working on the structure of information storage and have encountered some difficulties.
I originally intended to do this:

class University(models.Model): #модель университета
    shortTitle = models.CharField(max_length=200)
    fullTitle = models.TextField()
    specialty = models.ForeignKey(Specialty) #объект специальности

class Specialty(models.Model): #модель учебной специальности
    code = models.CharField(max_length=9)
    title = models.CharField(max_length=200)
    points = models.CharField(max_length=3) #Проходные баллы по специальности

The complexity is as follows:
1. How to associate a university with a specialty, using many-to-many, given that each university has unique passing scores in a specialty?
2. How to store subjects and passing scores for these subjects for each specialty, depending on the university?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2017-10-29
@alexgugr

SpecialtyScoreForUniversity:
  university
  specialty
  score

You can also use https://docs.djangoproject.com/en/1.11/ref/models/...
Only it is desirable to know what requests will be more in order to stick the field either to the University or to the Specialty
shortTitle
short_title
fullTitle
full_title
Name of classes CamelCase
Title under_score variables

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question