Hi I have created a Mixin that overrides just the get_form method, to be used with a class that inherits from CreateView. The Mixin inherits from object. In my view, when I include CreateView and my mixin in that order, the mixin code doesn't get executed. But when I swap the order of inheriting the classes, the mixin code works but the form processing of CreateView doesn't. What could be the issue here? The code is at http://dpaste.com/hold/809974/
I understand that this behaviour has to do with Python's MRO, which I came across just now. But I have very little knowledge of Django's generic views to understand why the form processing doesn't work when the mixin code works on changing the order of inheritance.
On Thu, Oct 4, 2012 at 4:55 PM, Guruprasad L <lgp1...@gmail.com> wrote:
> This is the first time I am using mixins in code. I read mixed opinions
> about mixins, a few of them saying that it is bad. If it is bad, is there
> some other way to implement this?
regardless of any moral issues for or against mixins, this is how
class based views are currently designed: you can subclass to add
concrete functionality once, or create a mixin to apply some
functionality to several concrete subclasses.