c3lf-system-3/core/tickets/models.py

32 lines
1 KiB
Python
Raw Normal View History

2023-11-23 22:17:20 +00:00
from django.db import models
from django_softdelete.models import SoftDeleteModel
from inventory.models import Event
class IssueThread(SoftDeleteModel):
id = models.AutoField(primary_key=True)
2023-12-06 03:51:47 +00:00
name = models.CharField(max_length=255)
state = models.CharField(max_length=255, default='new')
assigned_to = models.CharField(max_length=255, null=True)
last_activity = models.DateTimeField(auto_now=True)
2023-11-23 22:17:20 +00:00
2023-12-06 13:56:00 +00:00
class Meta:
permissions = [
('send_mail', 'Can send mail'),
]
2023-11-23 22:17:20 +00:00
class Comment(models.Model):
id = models.AutoField(primary_key=True)
2023-12-06 03:34:22 +00:00
issue_thread = models.ForeignKey(IssueThread, on_delete=models.CASCADE, related_name='comments')
2023-11-23 22:17:20 +00:00
comment = models.TextField()
timestamp = models.DateTimeField(auto_now_add=True)
class StateChange(models.Model):
id = models.AutoField(primary_key=True)
2023-12-06 03:34:22 +00:00
issue_thread = models.ForeignKey(IssueThread, on_delete=models.CASCADE, related_name='state_changes')
2023-11-23 22:17:20 +00:00
state = models.CharField(max_length=255)
timestamp = models.DateTimeField(auto_now_add=True)