On Thu, Jun 17, 2010 at 1:44 AM, Nick Fitzgerald <fitz...@gmail.com> wrote: > I have forked bfirsh's code as well on > github: http://github.com/fitzgen/django-class-based-views > I have changed the code to use __new__ rather than copying self. I have also > merged in daonb's commit to make request implicit to all methods via > self.request. > All feedback is very welcome! :)
The __new__-based approach is just lovely. :) Really, it's much more elegant than copying self and it's very convenient to be able to access self.request and the configuration options from anywhere. This solves a lot of problems when you want to customize a view's behavior. We really missed this when we used Django's class-based Feed view. Some minor issues: The __init__ function isn't called with *args, **kwargs (at least, I think this was an oversight). FormView.POST should probably use self.get_content like View.GET does by default. Should there be different methods for each request.method, at all? Often form POST handling code can reuse the GET part if form validation fails. By splitting everything up in two methods you blow up the code unnecessarily. BTW, I think the current code would unnecessarily instantiate the form two times if the form doesn't validate. Also, _load_config_values should guarantee that you don't pass unsupported arguments. This should also work with inheritance. Bye, Waldemar Kornewald -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.