Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added handling for missing stock record in catalogue form

  • Loading branch information...
commit 389dcad1aeea69c4b9c5434a3b4d468dc661dfaf 1 parent 5ca255b
@codeinthehole codeinthehole authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 oscar/apps/dashboard/catalogue/views.py
View
5 oscar/apps/dashboard/catalogue/views.py
@@ -153,7 +153,10 @@ class ProductUpdateView(generic.UpdateView):
def get_context_data(self, **kwargs):
ctx = super(ProductUpdateView, self).get_context_data(**kwargs)
if 'stockrecord_form' not in ctx:
- ctx['stockrecord_form'] = StockRecordForm(instance=self.object.stockrecord)
+ instance = None
+ if self.object.has_stockrecord:
+ instance=self.object.stockrecord
+ ctx['stockrecord_form'] = StockRecordForm(instance=instance)
if 'category_formset' not in ctx:
ctx['category_formset'] = ProductCategoryFormSet(instance=self.object)
if 'image_formset' not in ctx:
Please sign in to comment.
Something went wrong with that request. Please try again.