#django

/

      • HowardwLo
        ok, thank you
      • mattmcc
        unicodedata.normalize
      • schinckel
        That sounds like it.
      • AntelopeSalad
        mattmcc: so you would say in django it's common practices/idiomatic to just go hog wild with model methods in a template?
      • mattmcc
        AntelopeSalad: It depends on the data.
      • HowardwLo
        does that work in 2.7.6 ?
      • MarbinDrakon has quit
      • mattmcc
        HowardwLo: Of course.
      • AntelopeSalad
        mattmc: so far i've only been accessing the absolute url method directly but even that felt dirty
      • schinckel
        HowardwLo: unicodedata.normalize('NKFD', unicode(content)).encode('ascii', 'ignore') is the code I see in https://bitbucket.org/schinckel/django-sms-gate...
      • mattmcc
        AntelopeSalad: I'd suggest getting past that, this isn't MVC.
      • (Neither is anything else on the web)
      • HowardwLo
        schinckel: what is that for?
      • schinckel: I'm not…fluent enough :O
      • mattmcc
        NFKD ;)
      • zerick has quit
      • schinckel
        That's getting data ready to send via SMS, I can't remember what NFKD stands for. No F*cKing iDea, I guess. :)
      • mattmcc
        Normalized form common and NF.. something
      • mstrcnvs joined the channel
      • AntelopeSalad
        mattmcc: ok, fair enough
      • HowardwLo
        I'm confused now lol
      • ustunozgur joined the channel
      • hyperair has quit
      • mstrcnvs
        hay ther
      • AntelopeSalad
        i guess the only thing that matters is being able to change the implementation of the method without it breaking the template
      • zkanda joined the channel
      • mattmcc
        HowardwLo: There's more than one way to normalize unicode characters into ascii equivalents.
      • HowardwLo
        mattmcc: if i only want to change https://dpaste.de/pqbJ
      • what would you suggest?
      • livingstn joined the channel
      • mattmcc
        AntelopeSalad: Right, exactly. And that's perfectly achievable with models and methods. I mean, you could swap the model out with a dictionary and the template wouldn't have to care.
      • HowardwLo
        its replacing a non ascii "/" to a ascii "/"
      • AntelopeSalad
        mattmcc: yeah, ok you convinced me
      • garrypolley joined the channel
      • siqi joined the channel
      • HowardwLo
        does it even matter which type to use?
      • in my case.
      • ustunozgur has quit
      • Gambit- joined the channel
      • thesheff17 joined the channel
      • thesheff17 has quit
      • thesheff17 joined the channel
      • siqi has quit
      • mattmcc
        I'm not sure that can be normalized. http://www.scarfboy.com/coding/unicode-tool%3Fs...
      • rgenito joined the channel
      • zkanda has quit
      • synfin has quit
      • scriptThis joined the channel
      • munichlinux joined the channel
      • chance has quit
      • zkanda joined the channel
      • ryanhiebert joined the channel
      • akhar has left the channel
      • livingstn has quit
      • Sam99 joined the channel
      • garrypolley has quit
      • Sam99
        I have an issue with CSRF, can anyone help?
      • mattmcc
        Not without more specifics.
      • Sam99
        I have created a pastebin entry
      • I hope this describes my problem
      • k_sze[work] joined the channel
      • I am working on a tutorial and this problem keeps coming up
      • did I provide enough information?
      • mattmcc
        {$ crsf_token $} should be {% csrf_token %}
      • karim has quit
      • ryanhiebert
        I wrote an auth backend that works... except both in the view that authenticates and logs in, and the redirect chain that the view triggers, the user isn't in the request. Do I need to manually put the user in the session? Shouldn't the redirect cause the middleware to put it in the session, like it does on subsequent requests?
      • Sam99
        on the template?
      • mattmcc
        Yeah.
      • alexsnake has quit
      • ryanhiebert: Assuming you're using the default auth middleware and login view, you should be fine.
      • Sam99
        I corrected that
      • hoot has quit
      • but still have same error message
      • ryanhiebert
        I'm using a particularly different authentication, so I've written my own login view. Default auth middleware
      • HowardwLo
        mattmcc: how would you go about removing the non ascii slash and replacing with regular slash?
      • ryanhiebert
        or rather, I'm using a different view to do this _kind_ of login
      • I use the default login view elsewhere
      • mattmcc
        ryanhiebert: So I'd compare your view to what the default login view does, and see what's missing.
      • HowardwLo: Well, since it doesn't normalize, you're probably stuck just doing a replace()
      • ryanhiebert
        ok, that sounds like a good idea. thanks for the pointer
      • riseriyo has quit
      • jhgaylor joined the channel
      • HowardwLo
        right, i have that now. the replace is throwing me an error. saying how no encoding is declared
      • Sam99
        mattmcc, did you see my response, I made that change but still am getting the same error message
      • estebistec has quit
      • envisean has quit
      • alexsnake joined the channel
      • livingstn joined the channel
      • livingstn has quit
      • livingstn joined the channel
      • Laybunz has quit
      • EyePulp joined the channel
      • munichlinux has quit
      • Mattmcc, are you still here?
      • ctcg joined the channel
      • billcd joined the channel
      • willingc joined the channel
      • munichlinux joined the channel
      • Can anyone help me with a CSRF problem?
      • coddingtonbear is now known as coddingtonbear_a
      • munichlinux has quit
      • billcd has quit
      • immerser has quit
      • Siecje has quit
      • billcd joined the channel
      • rgenito has quit
      • Does anyone know enough about the CSRF to help me with a problem on a tutorial?
      • twikz_ joined the channel
      • billcd has quit
      • al1o has quit
      • panuta joined the channel
      • panuta has quit
      • bradfordtoney has quit
      • bradfordtoney joined the channel
      • al1o joined the channel
      • SmileyChris
        Sam99: sure
      • Sam99
      • i think i detailed out everything
      • twikz has quit
      • 1 thing though the error on the html page has been corrected but still get the error message
      • phildini has quit
      • atula joined the channel
      • chance joined the channel
      • atula has quit
      • hoody_k has quit
      • nedbat has quit
      • chance has left the channel
      • SmileyChris
        Sam99: so in the rendered html, is the csrf hidden input being added?
      • Sam99
        im not sure what you mean, I am new at this programming
      • but the create_article.html is included on the pastebin
      • SmileyChris
        Sam99: view the source in your browser
      • ctcg has quit
      • ah, i see
      • You're doing {$ rather than {%
      • try fixing that :)
      • bradfordtoney has quit
      • Sam99
        I fixed that but still get the same error message
      • SmileyChris
        did you go back to the rendered view, refresh that, and then submit your form again?
      • in any case, go back to the url for that view and refresh
      • s/rendered view/rendered template/
      • if you tried to just refresh the post request, it still wouldn't contain the csrf token in the form, hence you'd get the same errror
      • Sam99
        it removed the error message
      • but something is not working
      • thanks for your help, I am gonna go back to the tutorial and find out what is not working
      • SmileyChris
        np
      • furoido joined the channel
      • Sam99
        Thank you very much Chris for helping me. I htought that PHP is hard, but Django is really hard.
      • Sam99 has quit
      • ustunozgur joined the channel