Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'll paste my thoughts from a conversations I had with someone about them:

"There are places where the generic views could/should be simplified, get_template_names and get_form_class are horrendously complicated. But his big example is removing get_form_kwargs, which is probably my single most heavily-used function when using them (Django's generic class-based views). Overriding form_valid is always a little gnarly, because you need to know the implementation details to know it's not worth calling super."

In general, I'm not sold on Tom's specific implementation, primarily because it throws away parts of the API that I personally use quite heavily. Of course, the counter-argument is that he's kept the parts that he uses heavily. I suspect the ideal solution is somewhere between Tom's implementation and the existing one.



Hi Andrew, the migration notes cover the removal of `get_form_kwargs()`.

The simple answer here is that you're actually much better off just overriding `get_form()`. It's no more complicated, and it's much more direct and obvious. We can do away with `get_form_kwargs()`, `get_initial()` etc - they're unnecessarily granular.

> you need to know the implementation details to know it's not worth calling super

The simplicity is self re-inforcing here - the implementation is trivial, so it's easy to figure out how to totally override a method if you want too. Of course this doesn't prevent you from using a `super` style if you want to.


There's something about your example that wasn't convincing to me, but I've tried it out with some of my use cases. Whilst your approach is less DRY, it does seem to lead to more readable code, so I'm going to look into it further.

We should fork django-extra-views and see what we can come up with.


> We should fork django-extra-views and see what we can come up with.

Yup, that'd be interesting. Hopefully you've seen my comment to that effect here: http://django-vanilla-views.org/topics/django-extra-views-co...


A little amusing that the only bits that work are the bits I've been regretting merging in :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: