On 6/21/06, Grigory Fateyev <[EMAIL PROTECTED]> wrote:
http://code.djangoproject.com/wiki/RemovingTheMagic#Includetemplateextensionexplicitly
I don't think that's the problem. In my urlconf I have:
(r'^json/trails/(?P<trail_id>\d+)/$',
'trail_detail_json',
{'template_name': 'json/detail'}),
'trail_detail_json',
{'template_name': 'json/detail'}),
N.B. no extension on the template name.
And a very simple view:
def trail_detail_json(*args, **kwargs):
trail = get_object_or_404(trails, pk=kwargs['trail_id'])
if DEBUG:
response = HttpResponse(mimetype='text/plain')
else:
response = HttpResponse(mimetype='application/json')
t = loader.get_template(kwargs['template_name'])
c = Context({
'trail': trail,
})
response.write(t.render (c))
return response
trail = get_object_or_404(trails, pk=kwargs['trail_id'])
if DEBUG:
response = HttpResponse(mimetype='text/plain')
else:
response = HttpResponse(mimetype='application/json')
t = loader.get_template(kwargs['template_name'])
c = Context({
'trail': trail,
})
response.write(t.render (c))
return response
and an even simpler template:
{% load mista %}{{trail|json}}
what made you think that was the problem?
--
petef
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---