On Mon, Nov 28, 2011 at 4:07 PM, youpsla <youp...@gmail.com> wrote: > Hello, > in my code, I like to overrride the form_valid() method in both > CreateView and UpdateView generic class views. > > I've put my code in views.py. > > class MyCreateView(UpdateView): > ..... > def form_valid(self, form, **kwargs): > some code > > class MyUpdateView(CreateView): > ..... > def form_valid(self, form, **kwargs): > some code > > The both form_valid() methods are exactly the same (Only the > dispatch() method differ from both classes). > > My question is : is there a way of doing this more in a DRY way ? > > Thanks in advance. > > Best regards > > Alain >
http://stackoverflow.com/questions/533631/what-is-a-mixin-and-why-are-they-useful Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. 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.