Sunday, May 23, 2021

Re: Product Categories

Thanks Work,

Let me try that.

Regards.

On Sat, 22 May 2021, 21:48 N'BE SORO, <soro4827@gmail.com> wrote:
Ok use:

# In Python
# print(category.get_ancestors())
# In Jinja category.get_ancestors

Le sam. 22 mai 2021 à 18:14, Patrick Café <cafe.rainbow2@gmail.com> a écrit :
OK thank you

tech george <techgeorge4@gmail.com> schrieb am Sa., 22. Mai 2021, 19:11:
Hi Soro,

Is there a way I can fetch the data without using MPTT?


On Sat, May 22, 2021 at 6:31 PM N'BE SORO <soro4827@gmail.com> wrote:
Hi,
if you use MPTT templates, in your template use {% load mptt_tags %}

And you can proceed as follows for the display

{% load mptt_tags %}  <ul>      {% recursetree genres %}          <li>              {{ node.name }}              {% if not node.is_leaf_node %}                  <ul class="children">                      {{ children }}                  </ul>              {% endif %}          </li>      {% endrecursetree %} 

Le ven. 21 mai 2021 à 18:30, tech george <techgeorge4@gmail.com> a écrit :
Hello,

I need your help with rendering main category products only to the page, currently the code seems to be picking even sub category products.

Please see below screenshots.


category model.png
category model 2.png

views.png
category products.png

category.html code.png

Please advise.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CADYG20H6qB4GTVq1J%3D6GcR%2BEu_r53pk-X%3DKvbosMrRrVz9jLYQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAOtSHp_ka4EERa%2B0hfJapGUNMRwziSe0S5xphDU92f9fzjjg3Q%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CADYG20EJE7hdVyFz%3D0-a-0QQyTfVR8OBPHDe24i3CFQFMA5cmw%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAA%2B%2BAZxavstcDeL-fMKgtU%2BjnQDznwmm6cfYXDkv-d46OvvRjg%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAOtSHp9wDcmdSg%3DM8JEzM%3DuuhMVFgers0uST5k-EqB37iZKvJg%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CADYG20Gx0dPBjqG4RD0TtkZMDhmHY1Jpza74LDspE2N4fpwSqA%40mail.gmail.com.

No comments:

Post a Comment