On 30 août, 22:17, AndyB <[EMAIL PROTECTED]> wrote:
> (next time - think>post instead of post>think...)
Lol. Don't worry, we all face the same problem one day or another...
> However. The fact we are in Django's template language with less of
> the niceties of Python does change things. We can't explicitly cast
> types so what should we do?
restrict ourselves from writing application logic in templates ?-)
> <snip>
>
> > Also and FWIW, the use case (hem...) mentionned in the django-snippet
> > you linked to is IMHO a design smell. Such a test has nothing to do in
> > a template.
>
> I'd be interested to read exactly what the design smell is here. Could
> you elaborate?
The use case I'm talking about is this one:
{% ifequal request.GET.key object.id %}
never
{% endifequal %}
This is obviously (to me at least) application logic, that should be
handled in the view (or any other part(s) of the controller), not in
the template. Python is a dynamic language that let you add any
arbitrary attribute to an object on the fly, so it should be the
view's responsability to mark 'object' as being somehow "special" by
adding a corresponding attribute before passing it to the template.
Then the template should only have to look for this attribute.
My 2 cents...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---