On Tue, Jul 15, 2008 at 9:10 AM, vicvicvic <[EMAIL PROTECTED]> wrote:
> On Jul 15, 3:13 pm, Arien <[EMAIL PROTECTED]> wrote:
>> On Tue, Jul 15, 2008 at 7:34 AM, vicvicvic <[EMAIL PROTECTED]> wrote:
>> > On Jul 15, 1:57 pm, Arien <[EMAIL PROTECTED]> wrote:
>> >> On Tue, Jul 15, 2008 at 5:36 AM, vicvicvic <[EMAIL PROTECTED]> wrote:
[...]
> While a view cannot (should not) know the contents of the template
> used to serialize the content, loading a template named
> "whatever.html" couples it to an HTML Content-type. I does not make
> sense to serialize JSON data in a template named .html. I could of
> course use templates named "whatever.serializing_template" and use
>
> {% ifequal content_type "json" %}[1234,3452]{% else %}<p>1234</
> p><p>3452</p>{% endif %}
>
> in my template code but I think that looks butt-ugly. Also, how do I
> set the Content-type-header in a Template?

Why not pass the template and the Content-Type to the view?  See
django.views.generic for examples of that approach.

>> >> Django is a *Web* framework.  Views are the part of the framework that
>> >> generate responses to requests and both of those necessarily use HTTP.
>>
>> > A response-request paradigm is hardly unique to HTTP. Yes, Django is a
>> > web framework and yet, both models and templates are (naturally)
>> > decoupled from HTTP. The documentation even includes a paragraph about
>> > using templates in stand-alone mode!
>>
>> Sure, but that doesn't apply to views.
>
> Why not?

Views are your interface to the outside world, and since Django is a
Web framework that world speaks HTTP.


Arien

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to