Pārlūkot izejas kodu

Correct initialisation of stockrecord form

Fixes #336
master
David Winterbottom 13 gadus atpakaļ
vecāks
revīzija
d9a7029a00
1 mainītis faili ar 3 papildinājumiem un 4 dzēšanām
  1. 3
    4
      oscar/apps/dashboard/catalogue/views.py

+ 3
- 4
oscar/apps/dashboard/catalogue/views.py Parādīt failu

@@ -208,13 +208,12 @@ class ProductUpdateView(generic.UpdateView):
208 208
         stock record it will be passed into the form as
209 209
         ``instance``.
210 210
         """
211
-        if not self.is_stockrecord_submitted():
212
-            return StockRecordForm(self.object.product_class)
213
-
214 211
         stockrecord = None
215 212
         if self.object.has_stockrecord:
216 213
             stockrecord = self.object.stockrecord
217
-
214
+        if not self.is_stockrecord_submitted():
215
+            return StockRecordForm(self.object.product_class,
216
+                                   instance=stockrecord)
218 217
         return StockRecordForm(
219 218
             self.object.product_class,
220 219
             self.request.POST,

Notiek ielāde…
Atcelt
Saglabāt