recursion - how to recursively group products by its category in django -
i have category model related , products model related category model.
category(models.model): name = ... subcategory = models.foreignkey(self, related_name="subcategory", null=true, blank=true) product(models.model): name = .... category = models.foreignkey('category', related_name='productcategory')
i need list products in template recursive category groups, instance:
1st main category: products linked 1st main category 1st level sub category of 1st main category: products linked 1st level sub category 2nd level sub category of 1st level sub category: products linked 2nd level sub category 2nd level sub category of 1st main category: products linked 1st level sub category 2nd main category: products linked 2nd main category 1st level sub category of 2nd main category: products linked 1st level sub category 2nd level sub category of 1st level sub category: products linked 2nd level sub category ...
should make grouping in view , how can this?
Comments
Post a Comment