I'm sorry, I misread it. Please mention form.instance field in "forms for models" docs somewhere.
The gain is inheritance. If one of your view classes is intented to be subclassed and requires logging in, Mixins are natural solution, methinks -- Best Regards, Valentin Golev Lead Developer r00, http://r00.ru http://valyagolev.net +7 921 789 0895, avaiable 12:00-18:00 MSK On Fri, Nov 5, 2010 at 6:47 PM, Russell Keith-Magee <[email protected] > wrote: > On Fri, Nov 5, 2010 at 11:40 PM, Valentin Golev <[email protected]> wrote: > > Are you certain about self.instance? > > > http://code.djangoproject.com/browser/django/trunk/django/views/generic/edit.py > Lines > > 173 and 90 tell me another thing... > > I didn't say self.instance. I said *form*.instance. > > > Well, Django can provide tools for extending views with either decorators > or > > mixins (or both - won't it cause uncertainity? maybe with some > > recommendation). Like the one from my example, > > django.contrib.auth.decorators.login_required can be transformed into > Mixin. > > Will it be? > > Unlikely, because login is a natural fit for a decorator. > > You have a view. The operation of that view can be a black box with > regards to login. The decorator can check login status, and redirect > if you're not logged in; or call the black box if you are. > > Sure, you *could* implement this as a mixin, but I'm not sure I see > the gain in offering two ways to do the same thing. > > Yours, > Russ Magee %-) > > -- > You received this message because you are subscribed to the Google Groups > "Django developers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<django-developers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/django-developers?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
