carljm: The tutorial first shows a rather clumsy way of doing it and afterwards the shortcut.
Honeyman joined the channel
mattmcc
The tutorial demonstrates the individual steps (create a context, render a template, return the response) so that you know how what the process is.
Rather than only showing you the shortcut without you ever learning what the shortcut actually does.
pydave6367 has quit
empedokles78
mattmcc: It seems just neater syntax.
DLSteve joined the channel
zlalanne has quit
lorddaedra has quit
carljm
empedokles78: It is neater syntax. But it's useful to know the individual steps and components, because sometimes you need to do something different (e.g. render a template and don't place the resulting string into an HTTP response).
mattmcc
Using a calculator is easier than doing long division. That's not a reason to skip teaching long division in schools.
david5aa has quit
In this case, knowing how render() works is important, it's part of understanding the whole HTTP request/response cycle.
jarshwah joined the channel
empedokles78
carljm: It's not that this steps are tought in an understandable way for that sake.
jarshwah has quit
ayaka has quit
jarshwah joined the channel
"render a template and don't place the resulting string into an HTTP response" - Do you mean for a PDF or something?
jessamynsmith has quit
domino14_
can I add a through field to a many-to-many field that already exists?
would a migration pick it up properly
bahoo joined the channel
bahoo has quit
adamg has quit
sagaragarwal94 has quit
msc has quit
krawchyk has quit
ayaka joined the channel
jessamynsmith joined the channel
jrist has quit
empedokles78
Why is "request" used? Is there an instance where request isn't part of the cycle?
michalmo has quit
mattmcc
Context processors require a request object as an argument.
And render() uses RequestContext by default to run context processors.
jrist joined the channel
slick666_work joined the channel
gopar has quit
gopar joined the channel
empedokles78
mattmcc: An the second question?
zlalanne joined the channel
JesseH has quit
mattmcc
If you aren't handling a request, then you wouldn't be using render() anyway.
ambar joined the channel
the_rat has quit
empedokles78
Hm. Then the render method could be made cleaner.
Honeyman has quit
jaddison joined the channel
mattmcc
The shortcut? It's two lines of code.
empedokles78
The render method. It could only take the template and a context as arguments.
slick666_work has quit
As in bottle: "return template('<b>Hello {{name}}</b>!', name=name)"
mattmcc
It needs the request for context processors. If you don't want to use context processors, there's render_to_response.
empedokles78
Cleaner code..
mattmcc
Eh, that's debatable.
empedokles78
2 instead of 3 arguments.
mattmcc
return render_to_response('foo.html', context)
__machine joined the channel
Already exists. In fact it predates render().
shannonlucas has quit
bahoo joined the channel
empedokles78
Okay, shorter code. :) Does the tutorial explain what a context processors is?
NomadJim has quit
mattmcc
No, but the template guide which the tutorial links directly to does.
__machine
in 1.7 it should be allowed to squash migrations that are needed by other squashed migrations, right? i squashed app1 migrations which had a dependency on app2 migrations… when i try to squash app2 migrations i get KeyError app1.0001_squashed… dependencies reference nonexistent parent node (app2, …) ?
NomadJim joined the channel
lvanderpool has quit
DarkSector
Uh what? ImportError: No module named hmac.urls
empedokles78
What's the template engine with the least verbosity?
SpeakerToMeat has quit
melhiors has quit
rkj joined the channel
mattmcc
Python's format strings are pretty terse. :P
choosegoose has quit
Debnet has quit
ubuntu_aze joined the channel
DarkSector: Do you happen to have an hmac module in your code that's blocking you from the stdlib package?
DarkSector
nope
mattmcc
What's hmac.__file__ say in a shell?
DarkSector
there isn't an mac file
*hmac
django-registration==1.0 doesn't have hmac module
and that is the stable one
Maybe I should be using django-registration-redux?
empedokles78: Django as of 1.8 supports writing support for third party template engines, so you're welcome to write an adapter to use that engine with Django.
empedokles78
mattmcc: Way over my head.
But maybe there is something in the same vain already?
mattmcc
DarkSector: Ah, yeah, registration 1.0 certainly wouldn't support current Django versions. So redux would work. Although workon django-registration proper has resumed recently. http://www.b-list.org/weblog/2015/aug/13/django...
empedokles78: You can look around, but I wouldn't bet on it. Between the native engine and Jinja, it seems most people go with one or the other.
DarkSector
mattmcc I have a very small app with restricted user creation. Isn't there a way to get a simple user password set using password reset?