Posted by & filed under python.

Какая разница между block, placeholder, variable? Этот вопрос я задал в официальной группе проекта:

What the main difference between block, placeholder, variable? I can
write {% block content %}{% endblock%}, {%placeholder content%}
{%endplaceholder%}, or {{content}}. But i want to know right way

И вот ответ:

A block is a Django specific thing. It comes with Django’s templating
language. You can define {% block content %} in your base template. Then you
can define a sub template that extends your base template and override {%
block content %} in your sub template.

A placeholder is a django-cms thing. You can place it in your default
template, then create a new page in the cms’ page admin and base that page
on your default template. Now the admin will show all placeholders that you
have placed in your template. Your editors are able to place plugins into
placeholder (i.e. a TextPlugin, followed by a PicturePlugin, followed by two
more TextPlugins).

Variables get added to the context by views and middlewares. Have a look at
the documentation about writing CMSPlugins for django-cms. Plugins are
basically views that add stuff to the context. Whatever you add to the
context dictionary will be available as {{ variablename }}

Вот ссылка на оригинал:
http://groups.google.com/group/django-cms/browse_thread/thread/53419479f144f26a

Опубликовать в Facebook
Опубликовать в Google Plus

Leave a Reply

You must be logged in to post a comment.