A
A
Artem Shishkov2019-05-02 19:37:36
Django
Artem Shishkov, 2019-05-02 19:37:36

Categories of the model, how to implement?

Here is a model for example about a book, a book can have several genres. And when you click on a genre, a list of books that have this genre opens, how to implement this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FulTupFul, 2019-05-02
@Combot

class Category(models.Model):
    pass

class Book(models.Model):
    categories=models.ManyToManyField(Category)

https://docs.djangoproject.com/en/2.2/topics/db/mo...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question