I never claimed it wasn't; it was stipulated that Django's template
system wipes the floor with all others, and it is inconceivable to
think more favourably of a different system.

I was trying to point out that there are features which are available
in other template languages, which people may consider to be superior,
but which do not fit into the django philosophy.

wrt calling functions that take arguments, allow me to re-state: in
smarty you can call _arbitrary_ functions. Template tags allow you to
call _specific_ functions. It's a design decision, and I'm very glad
that you cannot in django - if you've ever had to edit ZPT, you would
understand.

At the end of the day, if you truly disagree with the syntax/style of
django's templating engine, it is trivial these days to plug in a
different engine.

Cheers

Tom

On Thu, May 27, 2010 at 1:23 PM, Chuck Harmston <[email protected]> wrote:
> The inability to assign variables is an intentional design decision; one of
> Django's core tenets is that business logic and presentational logic should
> be separated. The template language was crafted to provide non-programmers
> (front-end developers and designers) the ability to work directly on
> templates without having to touch the business logic. Though there are use
> cases where defining variables would be helpful, it's a good flag that
> you're approaching the problem the wrong way.
> Additionally, you can call functions that take arguments, it just takes a
> slightly different form than you might expect: custom template tags [2].
> This allows you to extend the functionality of the template language while
> still maintaining the separation of business and presentational logic.
> An interesting historical example of the above two paragraphs: the smart {%
> if %} tag [1], which was borne of the lack of an ability to use complex
> logic in Django templates.
> And the important footnote: I don't mean to stifle your suggestion; quite
> the opposite, actually! As Jacob has admitted [3], there is an occasional
> need in the Django for designers to tell the programmers to STFU. To extend
> the previous example: the smart {% if %} tag was originally shot down but
> was ultimately implemented in core [4].
> [1] http://djangosnippets.org/snippets/1350/
> [2] http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#passing-template-variables-to-the-tag
> [3] http://groups.google.com/group/django-developers/browse_thread/thread/18bca037f10769e9/cfd908f97b44e324?lnk=gst#cfd908f97b44e324
> [4] http://code.djangoproject.com/changeset/11806
>
>
> On Thu, May 27, 2010 at 7:36 AM, Tom Evans <[email protected]> wrote:
>>
>> Most PHP templating languages allow you to do things that are by
>> design not in django's templating, for example in Smarty, one can
>> assign new variables on the fly in the template, and even do crazy
>> stuff like call functions that take arguments.
>>
>> Whether that is 'better' or not is a point of view - as you've a
>> commit bit, and patches for this sort of stuff in django are rejected,
>> I'd guess you are of the view that it is not ;)
>>
>> Cheers
>>
>> Tom
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django developers" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/django-developers?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/django-developers?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to