Remove the 'supplier_part' field when first creating a Part object

- As the Part does not yet exist, there are no matching SupplierPart objects
This commit is contained in:
Oliver Walters 2019-04-28 23:55:21 +10:00
parent 4e3702384b
commit bc12af5994

View File

@ -91,6 +91,15 @@ class PartCreate(AjaxCreateView):
return context return context
def get_form(self):
form = super(AjaxCreateView, self).get_form()
# Hide the default_supplier field (there are no matching supplier parts yet!)
#form.fields['default_supplier'].widget.attrs['hidden'] = True
del form.fields['default_supplier']
return form
# Pre-fill the category field if a valid category is provided # Pre-fill the category field if a valid category is provided
def get_initial(self): def get_initial(self):
""" Get initial data for the new Part object: """ Get initial data for the new Part object: