Skip to content

Commit 2029f1d

Browse files
authored
fix creation of a new AAQConfig (#7297)
1 parent f5d21a0 commit 2029f1d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

kitsune/questions/admin.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,15 @@ class QuestionLocaleInlineFormSet(BaseInlineFormSet):
4747
def clean(self):
4848
super().clean()
4949

50+
if not self.instance.pk:
51+
return
52+
5053
# Calculate how many locales actually remain after deletions.
5154
num_locales = self.total_form_count() - len(self.deleted_forms)
5255

5356
active_configs = self.instance.support_configs.filter(is_active=True)
5457

55-
if (num_locales == 0) and self.instance.pk and active_configs.exists():
58+
if (num_locales == 0) and active_configs.exists():
5659
product_names = ", ".join(active_configs.values_list("product__title", flat=True))
5760
raise forms.ValidationError(
5861
"Cannot remove all enabled locales. This configuration is used "

0 commit comments

Comments
 (0)