Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

jingo's direct_to_template should be consistent with Django's version of it #2

Closed
fwenzel opened this Issue · 3 comments

3 participants

@fwenzel
Collaborator

Django's direct_to_template allows setting the template, mimetype, and extra_context: http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-generic-simple-direct-to-template

Jingo, instead takes the dictionary it is fed as kwargs and drops its content directly into the context. This makes setting the mime type impossible.

@fwenzel
Collaborator

Just replacing direct_to_template with jingo.render in urls.py is apparently a workaround.

@jbalogh
Owner

I like that. Does that mean we can get rid of jingo.views?

@fwenzel
Collaborator

I think so. The syntax needs to change from url('/foo', direct_to_template, {template: x.html, var1: ...}) to url('/foo', jingo.render, {template: x.html, context: {var1:..., var2: ...}} -- the nested dictionaries are a little less fun than before, but if we do that, jingo.views becomes obsolete.

@jsocol jsocol closed this issue from a commit
James Socol Remove jingo.views and tests. Fix #2.
With the changes since #2 was filed, it's no longer necessary to have
jingo.views.direct_to_template at all. Django's direct_to_template view
works just fine with jingo.Loader.

I cleaned up some tests, but jingo.render_to_string is still a different
function than django.template.loader.render_to_string, so I wasn't able
to drop that.
52b1f57
@jsocol jsocol closed this in 52b1f57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.