Merge pull request #1124 from eeintech/fix_nocategory_templates_error

Check that category was selected before fetching templates
This commit is contained in:
Oliver 2020-11-13 10:41:51 +11:00 committed by GitHub
commit 1d4b826d03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

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

View File

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