Show a form to create a new checklist, with the possibility to use a preset template

This commit is contained in:
Benbb96
2023-04-23 00:36:10 +02:00
parent 8be55fb7f2
commit b8d06a0fb1
4 changed files with 53 additions and 3 deletions

View File

@@ -2028,6 +2028,12 @@ class ChecklistTemplate(models.Model):
def __str__(self):
return self.name
def create_checklist_for_ticket(self, ticket):
checklist = ticket.checklists.create(name=self.name)
for task in self.task_list:
checklist.tasks.create(description=task)
return checklist
class Checklist(models.Model):
ticket = models.ForeignKey(