Thursday, November 27, 2014

Newbie: How to implement a app/module, which I can include from my html?

Hi guys,

I want to display a block of category-links in various places of the website. Those links are populated by making a Category.objects.all request in a view. So right now it seems like each view that should contain those links needs to put the "Category" Model in its context.

Now I would be really thankful for a tip on how to NOT repeat myself (DRY):
Is there a way to "{% include 'category-links.html' %}" and have the .html get its content from a specific view?

Kind regards
Thomas

--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3b775f43-a8fc-49c8-8371-f79f95bfbac8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment