Hi everyone!

I'm sorry to put this subject on the table again, but I maybe have some new 
arguments.

The main point for not adding multiline tags support is to "force" 
developers to keep logic outside templates and keep templates as simple as 
possible.
I agree on this point and the Django templating system is doing a great job.

But sometimes (many times in fact), this is required not for logic.
I have at least one main example: the {% blocktrans %} template tag with 
parameters.
In this case there is no logic at all, but I find myself writing this kind 
of translation a lot of time:

{% blocktrans with from=some_object.from_date|date:"SHORT_DATE_FORMAT" 
to=some_object.to_date|date:"SHORT_DATE_FORMAT" %}
{{ from }} to {{ to }}
{% endblocktrans %}

If I don't want to include line returns, I must write:
{% blocktrans with from=some_object.from_date|date:"SHORT_DATE_FORMAT" 
to=some_object.to_date|date:"SHORT_DATE_FORMAT" %}{{ from }} to {{ to }}{% 
endblocktrans %}

In this example, I only have two dates and names are relatively shorts and 
the line is already huge to me.

I can't stop thinking this would be easier to write and understand:

{% blocktrans with
    from=temporal_coverage.from|date:"SHORT_DATE_FORMAT"
    to=temporal_coverage.to|date:"SHORT_DATE_FORMAT"
%}
{{ from }} to {{ to }}
{% endblocktrans %}

or even better to remove line returns:

{% blocktrans with
    from=temporal_coverage.from|date:"SHORT_DATE_FORMAT"
    to=temporal_coverage.to|date:"SHORT_DATE_FORMAT"
%}{{ from }} to {{ to }}{% endblocktrans %}

The same applies to {% with %} template tag because tend to think this:

{% with
     some_var=some_object.some_nested.some_attr
     another_var=another_object.some_nested.some_attr
%}

is simpler to write and read than:

{% with some_var=some_object.some_nested.some_attr 
another_var=another_object.some_nested.some_attr %}

Having to horizontally scroll my logicless templates every times is a real 
pain in the ass!!

The Django slogan is "The Web framework for perfectionists with deadlines" 
and as a perfectionist with deadline, I want write clean code without 
having to waste time writing a custom template tag for each specific case.
So if the point beside "keeping logic outside templates" is to keep 
template simples, I think there should be multine template tags support, at 
least tags supporting args and kwargs.
If I follow the current reasoning (you don't want people using args and 
kwargs too much) then you should simply remove them but it will be a sad 
move.

Best,

--
Axel H.

-- 
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+unsubscr...@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/c2e52c39-ba8d-4bd6-a0be-879db4b440e7%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to