tangentlabs/django-oscar — pull request #312 by elbaschid (2012-09-23 14:44:39+00:00)
Title: creating product now checks for unique UPC

Attempting to create a new product with a UPC that already exists
raises an ``IntegrityError`` instead of handling the ``ProductForm``
as an invalid form with an appropriate ``ValidationError``.

I fixed that by adding a ``clean_upc`` validation method to the
form by checking for an existing product by UPC. I am not sure if
that is the most efficient way to validate this. If there's a
better alternative, I am happy to change it...and learn something
:)

**Note:** I switched the functional tests in ``product_tests.py``
to use ``WebTest`` while I was at it.