(well, for it to have the intended effect, that is)
vbabiy joined the channel
alperkanat joined the channel
tauntaun
karanlyons: thanks for the tip above.
asantos22
ah, think I may have figured it out
Z_A_M has quit
karanlyons
asantos22: Couple things (may not fix your issue)
1) @receiver(post_save, sender=Book)
percent20 joined the channel
asantos22
ah, thankya
Milossh has quit
karanlyons: I think my issue was a for loop in the wrong if statement
karanlyons
2) def assign_user_points(sender, instance, created, raw, using, update_fields): (I know you've got **kwargs, but these are all the kwargs you'll ever get, and there aren't that many, so I'd prefer to list them)
mstrcnvs
karanlyons: isn't this the same of post_save.connect(...)?
karanlyons
asantos22: Might be, didn't get very far :D
pembo13 has left the channel
mstrcnvs: Pretty much, but it's more Django-y.
Gentlecat has quit
mstrcnvs
decorators are black magic
karanlyons
No they're not.
what_larks has quit
They're functions that take and return functions.
Simple.
Gentlecat joined the channel
dxdt joined the channel
oubiga has quit
MarkusH
And most the time straight forward
karanlyons
Actually, I'd kinda prefer decorators for Django admin registration and the like. Do they exist?
mstrcnvs
don't get me wrong here, but I was kidding with you
totte joined the channel
karanlyons
Oh, my bad.
mstrcnvs
I know what decorators are heh
_andyj_ joined the channel
dash_ has quit
just like Python is THE BEST LANGUAGE EVER, decorators are black magic!
just kidding :)
oubiga joined the channel
vbabiy has quit
alperkanat has quit
karanlyons
If you *really* want black magic, start messing around with stuff like __slots__.
As far as scripting languages go, Python is pretty rad. Also true for languages in general, in cases.
Laybunz has quit
guilhermebr has quit
mstrcnvs has left the channel
guilhermebr joined the channel
tomchristie joined the channel
tomchristie has quit
joshfinnie has quit
genomespam has quit
Is xian still maintaining typogrify? There's a pull request a year old.
guilhermebr has quit
guilhermebr joined the channel
JayFK joined the channel
joshfinnie joined the channel
alperkanat joined the channel
minim joined the channel
s/xian/xian\/mintchaos/
dnstbr has quit
guilhermebr has quit
tbaxter: I might take some time to build out tests for that update_fields mixin for Django, cause why not. Naming thoughts? Right now it's SaveOnlyChangedFields, which is...fine, but django-saveonlychangedfields is a hell of a thing to have to type.
s/build out tests for/build out tests and properly release/
It's rather trivial, but someone asked for tests, and if I'm writing tests I better be releasing the thing somewhere.
thedodd has quit
That is a really outdated titlecase module, though.
tbaxter
SaveTheChange
karanlyons
Damn, that's good.
tbaxter
that journalism degree comes in handy some days.
karanlyons
Haha, I've got a theatre degree, which comes in handy almost never (outside of theatre, obviously).
Ataxis
I'm trying to send data to a form's custom clean() function, and now instead of validating, it just emptys the form... take a look? http://pastebin.com/RJFxqrjc
nkuttler joined the channel
knite joined the channel
nonce_ has quit
minim has quit
ToApolytoXaos has quit
aliona_ has quit
ender979 has quit
knite
I have a view which is throwing an error. that part is fine. however, in addition to that error, django.request also throws an error about the request being forbidden due to missing the CSRF cookie. this is strange, because the earlier error proves that the request is not, in fact, forbidden. probably relevant - I have the dispatch method decorated with @method_decorator(csrf_exempt).
bender314 has quit
karanlyons
Ataxis: I'm not sure, but I don't think clean() is meant to return.
tbaxter
I don't think I'd try thumbnailing in a form.clean() at all.
karanlyons
Ataxis: And you'd want to super().clean(self) at the end.
Most of that should be in your Model.save(), though.
ashadocat joined the channel
knite: Is the decorator on your receiving view, or your sending view?
(Also, isn't it just `@csrf_exempt`?)
JayFK has quit
minim joined the channel
Ataxis
hmm ok.. I prolly don't really understand how the clean() works, I thought it was where you made sure all form fields are valid. the thumbnail is mostly to check if the image is uploaded...
knite
karanlyons: I'm not sure what you mean, I have exactly one view. it inherits from View and braces.views.JSONResponseMixin.
rideh has quit
mechaxl joined the channel
karanlyons
knite: So that's the view receiving the POST request? Try swapping out your decorator for just @csrf_exempt.
from django.views.decorators.csrf import csrf_exempt
knite
karanlyons: that's right, it's the view receiving the post. according to the CBV docs, @method_decorator is the correct way to apply csrf_exempt (or other decorators) to a View.
zeograd has quit
but I'll try your suggestion now regardless. :-)
karanlyons
Oh, CBVs...
imperman has quit
knite
Yeah, that's why there's a dispatch method.
sohail joined the channel
karanlyons
My bad.
eka has quit
alperkanat has quit
(In general, most problems here are of the "seen it before, it's that one line" variety. So I sometimes forget to look around.)
knite: So that's not the problem, I'd think. dpaste your code?
hex` joined the channel
knite
karanlyons: No worries, I do the same thing. Any thoughts on what might be happening here? I'm on Django 1.5. The actual view error is being thrown in my post() method, which is by definition after the CSRF check. So I'm totally stumped as to why Django would throw a CSRF error after executing that method.
I'll get the paste up.
karanlyons
If you can post the code plus error (and traceback if there is one), I'll try to help you out. I've been spending most of my time on this project on the backend, though, so we'll see how much use I can be.
I did this: amount = models.DecimalField(verbose_name=_('Amount'), max_digits=12, decimal_places=2, validators=[validate_amount], localize=True)
MrDaneelOlivaw
hello django!
jhgaylor joined the channel
maroloccio has quit
karanlyons
Tjati_: What version of Django are you running?
McMAGIC--Copy has quit
Tjati_
karanlyons: 151.
LysergicDreams has quit
asantos22
Okay, so I've gotten a bit more insight as to what's going on with the post_save. It keeps using data from the previous save for some reason. No idea why though. Wasn't a misplaced for loop after all. cc: karanlyons https://dpaste.de/CXjyt/
karanlyons
And USE_L10N = True is in your settings?
Tjati_
karanlyons: absolutly.
JoeLinux joined the channel
karanlyons
Huh.
McMAGIC--Copy joined the channel
dray3 has quit
mechaxl
I've got an infinite recursion problem that looks to be coming from django.utils.tree
Tjati_: Uh...are you doing this in you model, or form? Because localize is for forms.
evie_hammond has quit
alperkanat joined the channel
Tjati_
karanlyons: of course, a model.
knite
karanlyons: https://dpaste.de/mmQov/ . my error log has a traceback for the actual error. that's followed by WARNING django.request - Forbidden (CSRF cookie not set.): /my_url, with no additional trace info.
karanlyons
Tjati_: Pretty sure it's meant for forms.
Tjati_
karanlyons: stupid mistake. thank you.
karanlyons
No problem, took me a bit to see it, too.
Tjati_
karanlyons: you're absolutly right; documentation said it, too.
karanlyons
asantos22: The hell? Taking a look now.
knite: Give me a sec, I'll take a look.
Tjati_
karanlyons: thanks you and I beg your pardon that i disturbed you.