Thanks Work,

Let me try that.

Regards.

On Sat, 22 May 2021, 21:48 N'BE SORO, <soro4...@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.rainb...@gmail.com> a
> écrit :
>
>> OK thank you
>>
>> tech george <techgeor...@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 <soro4...@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 %}
>>>>
>>>> </ul>
>>>>
>>>>
>>>> source: https://django-mptt.readthedocs.io/en/latest/tutorial.html
>>>>
>>>> Le ven. 21 mai 2021 à 18:30, tech george <techgeor...@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.
>>>>>
>>>>>
>>>>> [image: category model.png]
>>>>> [image: category model 2.png]
>>>>>
>>>>> [image: views.png]
>>>>> [image: category products.png]
>>>>>
>>>>> [image: 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+unsubscr...@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
>>>>> <https://groups.google.com/d/msgid/django-users/CADYG20H6qB4GTVq1J%3D6GcR%2BEu_r53pk-X%3DKvbosMrRrVz9jLYQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> 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+unsubscr...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/CAOtSHp_ka4EERa%2B0hfJapGUNMRwziSe0S5xphDU92f9fzjjg3Q%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAOtSHp_ka4EERa%2B0hfJapGUNMRwziSe0S5xphDU92f9fzjjg3Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> 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+unsubscr...@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
>>> <https://groups.google.com/d/msgid/django-users/CADYG20EJE7hdVyFz%3D0-a-0QQyTfVR8OBPHDe24i3CFQFMA5cmw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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+unsubscr...@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
>> <https://groups.google.com/d/msgid/django-users/CAA%2B%2BAZxavstcDeL-fMKgtU%2BjnQDznwmm6cfYXDkv-d46OvvRjg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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+unsubscr...@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
> <https://groups.google.com/d/msgid/django-users/CAOtSHp9wDcmdSg%3DM8JEzM%3DuuhMVFgers0uST5k-EqB37iZKvJg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADYG20Gx0dPBjqG4RD0TtkZMDhmHY1Jpza74LDspE2N4fpwSqA%40mail.gmail.com.

Reply via email to