Closed aditya-singh177 closed 8 years ago
@aditya-singh177 You are the king of your Django app, not django-mptt-urls.
Add special method to your Category class:
class Category(MPTTModel):
# some stuff
def get_clothes(self):
# displays all items from all subcategories
return Clothing.objects.filter(parent__in=self.get_descendants(include_self=True))
Then use it in your template (category.html):
{% for clothing in instance.get_clothes %}
<li>{{ clothing.name }}</li>
{% empty %}
<li>No items</li>
{% endfor %}
This issue is not related to django-mptt-urls
.
thanks a lot contributor
There one more issue regarding the breadcrumbs...i can do for loop through the ancestors ..but the breadcrumbs end at some subcategory level ...what if i wanted to end the breadcrumb at product level (not any category ) of any subcategory
for eg:-men>menclothing>tshirt>nike black v neck tshirt(product level)
@aditya-singh177 Sorry, I cannot write code for you. You should definitely spend some time on learning Django basics.
This issue is not related to django-mptt-urls
.
ok thanks....
hello ...i followed django-mptt-urls....but i shows data only for the subcategory in which the photos are added but if we click on the category above it doesnt show any data...although it must show all the data present in together in all the below subcategories
for eg men>menclothing>tshirts men>menclothing>jeans
when clicking on menclothing it must show data for both tshirts and jeans combined