Better workflow for creating new ticket checklist, into a modal

This commit is contained in:
Benbb96
2023-04-30 03:11:27 +02:00
parent 11b2b36dd2
commit ef88a2ee8a
5 changed files with 59 additions and 36 deletions

View File

@ -641,15 +641,8 @@ class CreateChecklistForm(ChecklistForm):
required=False,
)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['name'].required = False
def clean(self):
if not self.cleaned_data.get('checklist_template') and not self.cleaned_data.get('name'):
raise ValidationError(_('Please choose at least a name or a template for the new checklist'))
if self.cleaned_data.get('checklist_template') and self.cleaned_data.get('name'):
raise ValidationError(_('Please choose either a name or a template for the new checklist'))
class Meta(ChecklistForm.Meta):
fields = ('checklist_template', 'name')
class FormControlDeleteFormSet(forms.BaseInlineFormSet):