add tickets module
This commit is contained in:
parent
6abf3af6c0
commit
649fff80f8
6 changed files with 104 additions and 0 deletions
|
@ -56,6 +56,7 @@ INSTALLED_APPS = [
|
||||||
'channels',
|
'channels',
|
||||||
'authentication',
|
'authentication',
|
||||||
'files',
|
'files',
|
||||||
|
'tickets',
|
||||||
'inventory',
|
'inventory',
|
||||||
'notify_sessions',
|
'notify_sessions',
|
||||||
]
|
]
|
||||||
|
|
0
core/tickets/__init__.py
Normal file
0
core/tickets/__init__.py
Normal file
48
core/tickets/migrations/0001_initial.py
Normal file
48
core/tickets/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
# Generated by Django 4.2.7 on 2023-12-09 02:13
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='IssueThread',
|
||||||
|
fields=[
|
||||||
|
('is_deleted', models.BooleanField(default=False)),
|
||||||
|
('deleted_at', models.DateTimeField(blank=True, null=True)),
|
||||||
|
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||||
|
('name', models.CharField(max_length=255)),
|
||||||
|
('state', models.CharField(default='new', max_length=255)),
|
||||||
|
('assigned_to', models.CharField(max_length=255, null=True)),
|
||||||
|
('last_activity', models.DateTimeField(auto_now=True)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'permissions': [('send_mail', 'Can send mail')],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='StateChange',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||||
|
('state', models.CharField(max_length=255)),
|
||||||
|
('timestamp', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('issue_thread', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='state_changes', to='tickets.issuethread')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Comment',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||||
|
('comment', models.TextField()),
|
||||||
|
('timestamp', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('issue_thread', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='tickets.issuethread')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,22 @@
|
||||||
|
# Generated by Django 4.2.7 on 2023-12-22 20:57
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('tickets', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='issuethread',
|
||||||
|
options={'permissions': [('send_mail', 'Can send mail'), ('add_issuethread_manual', 'Can add issue thread manually')]},
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='issuethread',
|
||||||
|
name='manually_created',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
]
|
0
core/tickets/migrations/__init__.py
Normal file
0
core/tickets/migrations/__init__.py
Normal file
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…
Reference in a new issue