Answer the question
In order to leave comments, you need to log in
How to group elements by field value in Django?
There is a product model that has a ForeignKey relationship with a product group model and with a catalog model.
class Product(models.Model):
catalog = models.ForeignKey(Catalog, related_name='catalog', on_delete=models.CASCADE)
division = models.ForeignKey(Division, related_name='division', null=True, on_delete=models.CASCADE) #группы товаров
title = models.CharField(max_length=500, blank=True, verbose_name='Заголовок')
...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question