tildetown-admin/ttadmin/help/models.py

44 lines
1.4 KiB
Python

from django.db.models import Model, TextField, EmailField, CharField, DateTimeField, ForeignKey
ISSUE_TYPE_CHOICES = (
('logging_in', 'help logging in'),
('concern_site', 'concern about the site'),
('concern_user', 'concern about another user'),
('package', 'install a package'),
('question', 'just a question',),
('other', 'something else'),
)
ISSUE_STATUS_CHOICES = (
('triage', 'to triage'),
('acked', 'acknowledged'),
('waiting', 'waiting to hear from submitter'),
('completed', 'nothing more to do'),
)
class Ticket(Model):
submitted = DateTimeField(auto_now_add=True)
name = CharField(blank=False, null=False, max_length=100)
email = EmailField(blank=False, null=False)
issue_type = CharField(choices=ISSUE_TYPE_CHOICES,
blank=False,
null=False,
max_length=50)
issue_text = TextField(blank=False, null=False)
issue_status = CharField(choices=ISSUE_STATUS_CHOICES,
blank=False,
null=False,
max_length=50,
default=ISSUE_STATUS_CHOICES[0][0])
def __str__(self):
return '{} from {}'.format(self.issue_type, self.name)
class Note(Model):
created = DateTimeField(auto_now_add=True)
body = TextField(blank=False, null=False)
author = ForeignKey('users.Townie')
ticket = ForeignKey(Ticket)