From 9795167d9beaea4b5aa6ce8c57a63ebad901343e Mon Sep 17 00:00:00 2001 From: bbe Date: Thu, 29 Oct 2020 23:29:16 +0100 Subject: [PATCH] Add merged_to information to ticket --- helpdesk/migrations/0033_ticket_merged_to.py | 19 +++++++++++++++++++ helpdesk/models.py | 9 +++++++++ 2 files changed, 28 insertions(+) create mode 100644 helpdesk/migrations/0033_ticket_merged_to.py diff --git a/helpdesk/migrations/0033_ticket_merged_to.py b/helpdesk/migrations/0033_ticket_merged_to.py new file mode 100644 index 00000000..98899213 --- /dev/null +++ b/helpdesk/migrations/0033_ticket_merged_to.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.13 on 2020-10-27 17:14 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('helpdesk', '0032_kbitem_enabled'), + ] + + operations = [ + migrations.AddField( + model_name='ticket', + name='merged_to', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='merged_tickets', to='helpdesk.Ticket', verbose_name='merged to'), + ), + ] diff --git a/helpdesk/models.py b/helpdesk/models.py index 95ab7601..d05dbd18 100644 --- a/helpdesk/models.py +++ b/helpdesk/models.py @@ -569,6 +569,15 @@ class Ticket(models.Model): verbose_name=_('Knowledge base item the user was viewing when they created this ticket.'), ) + merged_to = models.ForeignKey( + 'self', + verbose_name=_('merged to'), + related_name='merged_tickets', + on_delete=models.CASCADE, + null=True, + blank=True + ) + @property def time_spent(self): """Return back total time spent on the ticket. This is calculated value