add tickets module
This commit is contained in:
parent
6abf3af6c0
commit
649fff80f8
6 changed files with 104 additions and 0 deletions
33
core/tickets/models.py
Normal file
33
core/tickets/models.py
Normal file
|
@ -0,0 +1,33 @@
|
|||
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)
|
||||
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)
|
||||
manually_created = models.BooleanField(default=False)
|
||||
|
||||
class Meta:
|
||||
permissions = [
|
||||
('send_mail', 'Can send mail'),
|
||||
('add_issuethread_manual', 'Can add issue thread manually'),
|
||||
]
|
||||
|
||||
|
||||
class Comment(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
issue_thread = models.ForeignKey(IssueThread, on_delete=models.CASCADE, related_name='comments')
|
||||
comment = models.TextField()
|
||||
timestamp = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
|
||||
class StateChange(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
issue_thread = models.ForeignKey(IssueThread, on_delete=models.CASCADE, related_name='state_changes')
|
||||
state = models.CharField(max_length=255)
|
||||
timestamp = models.DateTimeField(auto_now_add=True)
|
Loading…
Add table
Add a link
Reference in a new issue