Check that category was selected before fetching templates

This commit is contained in:
eeintech 2020-11-12 16:52:22 -05:00
parent 265a29fa1a
commit d4ac35b9aa
2 changed files with 2 additions and 2 deletions

View File

@ -215,6 +215,7 @@ class EditPartForm(HelperForm):
class Meta: class Meta:
model = Part model = Part
fields = [ fields = [
'confirm_creation',
'category', 'category',
'selected_category_templates', 'selected_category_templates',
'parent_category_templates', 'parent_category_templates',
@ -224,7 +225,6 @@ class EditPartForm(HelperForm):
'revision', 'revision',
'bom_copy', 'bom_copy',
'parameters_copy', 'parameters_copy',
'confirm_creation',
'keywords', 'keywords',
'variant_of', 'variant_of',
'link', 'link',

View File

@ -350,7 +350,7 @@ class Part(MPTTModel):
# Get part category # Get part category
category = self.category category = self.category
if add_category_templates: if category and add_category_templates:
# Store templates added to part # Store templates added to part
template_list = [] template_list = []