Tuesday, July 29, 2014

Compositional Templates Django

What is the best way to create modular templates?

For example, if I have something like this:

#base file:  {header}  {block content}  {footer}    #main file:  {extends base}  {block content definition}    #product file:  {extends base}  {block content definition}

This is the django way from what I understand - filling in the blanks.

Now, my question is what if I needed a page like this:

{header}  {main}  {product}  {footer}

Basically, the main, and product are both inside the base file. I could try a deep inherit (a page that has main, which then consecutively loads product) but that does not work since the files both define 'content', and that is not possible in Django

--
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/ffa8324d-5e1f-4098-9c46-3c59a24cc972%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment