Re:Our custom Django mixins
by kennethlove on Thursday March 01, 2012 @04:06PM
(#3654041)
That is a really nice syntax. I kind of like the specificity of ``form_valid`` (for example), though.
And, yes, our mixins are Django-only (hence the title!)
Also, why the ``set_test_cookie`` on every GET?
Those snippets were taken from utkik's docs and are probably part of a larger code; but I agree they probably belong somewhere else, maybe in a middleware.
BTW, thanks for the nice post. Is the code available on github or bitbucket?
Re:Our custom Django mixins
by kennethlove on Friday March 02, 2012 @04:34PM
(#3658480)
Yeah, it is actually.
https://github.com/brack3t/django-braces is the Github repo, or you can ``pip install django-braces`` into your project. All the mixins are then imported from the ``braces`` package.
Re:Our custom Django mixins
by chrisjones on Thursday March 01, 2012 @04:19PM
(#3654102)
I did not know this existed, I'll have to give it a look. The setup method makes sense, not sure I like having to check is_valid() though.
A few months ago I started using a small class-based views library called aino-utkik[1] and haven't looked back.
Instead of this:
I can write this: which I find way more elegant.[1] https://github.com/aino/aino-utkik