#django

/

      • empedokles78
        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?
      • ambar has quit
      • empedokles78
        mattmcc: Something like http://bottlepy.org/docs/dev/stpl.html :)
      • mattmcc
        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?
      • mattmcc
      • DarkSector: There is a UserCreationForm that you can use in your view..
      • DarkSector
        I was kinda hoping for a signal that sends out an email that allows a user to set his password
      • so post_save on User
      • SpeakerToMeat joined the channel
      • mattmcc
        Sure, you could do that. Although you probably wouldn't want to send that email for every possible way that a user object gets created..
      • Like, in a shell. >>> User.objects.create(...)
      • DarkSector
        good point
      • empedokles78
        Thanks, mattmcc.
      • DarkSector
        so maybe just via view
      • kalem joined the channel
      • ambar joined the channel
      • ycon_ joined the channel
      • lvanderpool joined the channel
      • lvanderpool has quit
      • astrosoup has quit
      • kalem has quit
      • williamliu has quit
      • dray3 joined the channel
      • Tyrant has quit
      • zlalanne has quit
      • DLSteve has quit
      • ycon_ has quit
      • kalem joined the channel
      • half_brick joined the channel
      • restless_being has quit
      • half_brick has quit
      • ruind has quit
      • Quitta has quit
      • bikeshedder has quit
      • microdex has quit
      • donspaulding has quit
      • msg555 has quit
      • Bafflermeal joined the channel
      • d3ngar joined the channel
      • pydave6367 joined the channel
      • ambar has quit
      • dray3 has quit
      • d3ngar
        Hello, I'm getting NoReverseMatch error, even though I think I match the name fine: http://pastebin.com/xS2wkXmE. Any help appreciated
      • yopero_ has quit
      • kalem has quit
      • Lobstaman3 has quit
      • ruind joined the channel
      • lirt has quit
      • schinckel
        d3ngar: Your kwarg values don't match the regular expressions.
      • uidb64 of MQ does not match [0-9A-Fa-f]+
      • I think you have the arguments the wrong way around in your context.
      • disgrntld has quit
      • d42 has quit
      • d3ngar
        I'm going to switch uidb64 and tiken in the uRL
      • schinckel
        What does your view look like? It's likely to be there that the problem exists.
      • d3ngar
        I'm trying to use the default view
      • From django.contrib.auth.views.password_reset_confirm
      • when I paste the values in the URL the page renders fine
      • schinckel
        Instead of the {% url %} stuff, can you try:
      • empedokles78
        Someone knows of a Swiss Django-Freelancer?
      • schinckel
        uid: {{ uid }} / token: {{ token }}
      • d3ngar: And see what that does?