perf: 修改表结构

This commit is contained in:
ibuler
2022-09-06 19:57:03 +08:00
parent 984b8dfb28
commit 585ce6b46a
22 changed files with 159 additions and 886 deletions

View File

@@ -2,7 +2,6 @@ from django.db import models
from django.utils.translation import gettext_lazy as _
from perms.models import Action
from applications.const import AppCategory, AppType
from .general import Ticket
__all__ = ['ApplyApplicationTicket']
@@ -12,10 +11,10 @@ class ApplyApplicationTicket(Ticket):
apply_permission_name = models.CharField(max_length=128, verbose_name=_('Permission name'))
# 申请信息
apply_category = models.CharField(
max_length=16, choices=AppCategory.choices, verbose_name=_('Category')
max_length=16, verbose_name=_('Category')
)
apply_type = models.CharField(
max_length=16, choices=AppType.choices, verbose_name=_('Type')
max_length=16, verbose_name=_('Type')
)
apply_applications = models.ManyToManyField(
'applications.Application', verbose_name=_('Apply applications'),
@@ -29,14 +28,6 @@ class ApplyApplicationTicket(Ticket):
apply_date_start = models.DateTimeField(verbose_name=_('Date start'), null=True)
apply_date_expired = models.DateTimeField(verbose_name=_('Date expired'), null=True)
@property
def apply_category_display(self):
return AppCategory.get_label(self.apply_category)
@property
def apply_type_display(self):
return AppType.get_label(self.apply_type)
@property
def apply_actions_display(self):
return Action.value_to_choices_display(self.apply_actions)