#35636: differentiate placeholder and content provider blocks
---------------------------------+-----------------------------------------
     Reporter:  Yingjie Lan      |                    Owner:  Hashir Hassan
         Type:  New feature      |                   Status:  closed
    Component:  Template system  |                  Version:  5.0
     Severity:  Normal           |               Resolution:  wontfix
     Keywords:  template block   |             Triage Stage:  Unreviewed
    Has patch:  0                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  1                |                    UI/UX:  0
---------------------------------+-----------------------------------------
Comment (by Yingjie Lan):

 Hi Sarah Boyce, thanks a lot for your feedback! I have initiated a
 [https://forum.djangoproject.com/t/differentiate-placeholder-and-content-
 provider-blocks/33383 new topic] on the Django Forum. I am sorry that the
 proposed syntax looks confusing to you, I should have explained it with
 more clarity. The '=' sign is analogous to that in an assignment statement
 in most programming languages, since a content provider block can be seen
 as assigning a value or content to a block. Viewed in this way, hopefully
 the syntax now looks more natural and meaningful. Besides enhancing
 readability, I think there can be a lot of other benefits with this
 syntax, such as having a block accumulate contents gradually based on
 different conditions:

 {{{
   {% block usertools = %} my user tools {% endblock %}
   {% if user.authorized %}
      {% block usertools += %}, extra user tools {% endblock %}
   {% endif %}
 }}}

 In this illustration, if user.authorized is False, then the block content
 is simply 'my user tools', otherwise, it would be 'my user tools, extra
 user tools'. This would make the block content specification more flexible
 and convenient.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35636#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070190fe7287ad-e61188f1-bd3d-44c5-859d-b934acc22ada-000000%40eu-central-1.amazonses.com.

Reply via email to