This commit is contained in:
Oliver Walters 2020-05-22 22:27:52 +10:00
parent e6f56cb056
commit 5245442b11
3 changed files with 6 additions and 3 deletions

View File

@ -166,8 +166,12 @@ class AjaxMixin(object):
except AttributeError: except AttributeError:
context = {} context = {}
# If no 'form' argument is supplied, look at the underlying class
if form is None: if form is None:
try:
form = self.get_form() form = self.get_form()
except AttributeError:
pass
if form: if form:
context['form'] = form context['form'] = form

View File

@ -151,7 +151,6 @@ class TestReportFormatForm(HelperForm):
'template', 'template',
] ]
def __init__(self, stock_item, *args, **kwargs): def __init__(self, stock_item, *args, **kwargs):
self.stock_item = stock_item self.stock_item = stock_item

View File

@ -941,7 +941,7 @@ class StockItemSerialize(AjaxUpdateView):
# Pass the StockItem object through to the form # Pass the StockItem object through to the form
context['item'] = self.get_object() context['item'] = self.get_object()
form = SerializeStockForm(**context) form = StockForms.SerializeStockForm(**context)
return form return form