N
N
NerVik2016-02-28 18:11:20
Django
NerVik, 2016-02-28 18:11:20

How to implement such a connection?

There are models

class Games(models.Model):
    title = models.CharField()
    genres = models.ManyToManyField(Genres)

class Genres(models.Model):
    title = models.CharField()

It seems to be nothing complicated, but I wanted to make genres the same as on ru.riotpixels.com/games/call-of-cthulhu where next to each genre in the game there is a scale of its "influence", from 0 to 4. How to implement this at all understand, tell me?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem Klimenko, 2016-02-28
@NerVik

https://docs.djangoproject.com/es/1.9/topics/db/mo...
ManyToManyField - automatically creates an intermediate table, it is described above how to explicitly describe this table with the addition of the fields you need.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question