tangentlabs/django-oscar — pull request #548 by maikhoepfel (2013-03-05 09:33:03+00:00)
Title: Discuss: Merge ProductUpdateView and ProductCreateView

There's a lot of code duplication between the two views, which means more testing and more work for customizing. This is an attempt of merging the two.

The only difference between Django's `BaseUpdateView` and `BaseCreateView` is that `self.object` is `None` for the latter. Hence I've adapted `get_object` to return `None` if we're creating a product.

* 104 insertions, 169 deletions.
* The additional Formsets are now easily overriden.
* is_valid logic is more concise

Note: I can create and update products, and the tests run through. Given how mission-critical this is, I'd still call it experimental code.