8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-04 17:06:27 +00:00
re2o/tickets/models.py

45 lines
1.2 KiB
Python
Raw Normal View History

2019-07-06 08:25:24 +00:00
from django.db import models
2019-07-07 17:09:56 +00:00
from django.utils.translation import ugettext_lazy as _
2019-07-06 08:25:24 +00:00
2019-07-07 17:09:56 +00:00
import users.models
class Ticket(models.Model):
"""Class définissant un ticket"""
user = models.ForeignKey(
'users.User',
on_delete=models.CASCADE,
related_name="tickets",
blank=True,
null=True)
2019-07-07 17:09:56 +00:00
title = models.CharField(
max_length=255,
help_text=_("Nom du ticket"),
blank=False,
null=False,)
2019-07-10 08:28:16 +00:00
description = models.TextField(
2019-07-07 17:09:56 +00:00
max_length=3000,
help_text=_("Description du ticket"),
blank=False,
null=False)
date = models.DateTimeField(auto_now_add=True)
email = models.EmailField(
help_text = _("Une adresse mail pour vous recontacter"),
max_length=100,
null=True)
2019-07-07 17:09:56 +00:00
assigned_staff = models.ForeignKey(
'users.User',
on_delete=models.PROTECT,
related_name="tickets_assigned",
2019-07-10 08:28:16 +00:00
blank=True,
2019-07-07 17:09:56 +00:00
null=True)
#categories = models.OneToManyFiled('Category')
solved = models.BooleanField(default=False)
class Meta:
verbose_name = _("Ticket")
verbose_name_plural = _("Tickets")
def __str__(self):
return "Ticket de {} date: {}".format(self.user.surname,self.date)