On Friday, October 5, 2012 3:14:22 AM UTC+5:30, Guruprasad L wrote: > > 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. > > Ok, I found out the issue in the code. The mixin wasn't calling super and hence breaking the hierarchy. On adding it, the code works. 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?
Thanks & Regards, Guruprasad -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/6i9KD-iA8gkJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.