From 87fd342b6815f3ac9faf8acd4e87c9e1022eb3da Mon Sep 17 00:00:00 2001 From: ibuler Date: Fri, 25 Oct 2019 12:35:38 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E4=BF=AE=E6=94=B9model?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/jumpserver/settings.py | 1 + apps/orders/models.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/jumpserver/settings.py b/apps/jumpserver/settings.py index a2e1fa011..60d3f21cc 100644 --- a/apps/jumpserver/settings.py +++ b/apps/jumpserver/settings.py @@ -71,6 +71,7 @@ INSTALLED_APPS = [ 'audits.apps.AuditsConfig', 'authentication.apps.AuthenticationConfig', # authentication 'applications.apps.ApplicationsConfig', + 'orders.apps.OrdersConfig', 'rest_framework', 'rest_framework_swagger', 'drf_yasg', diff --git a/apps/orders/models.py b/apps/orders/models.py index d63e7b686..dd2e1624d 100644 --- a/apps/orders/models.py +++ b/apps/orders/models.py @@ -13,11 +13,17 @@ class Order(CommonModelMixin): TYPE_CHOICES = ( ('login_request', _("Login request")), ) - requester = models.ForeignKey('users.User', on_delete=models.SET_NULL, null=True, related_name='orders') - user_name = models.CharField(max_length=128, verbose_name=_("User")) + user = models.ForeignKey('users.User', on_delete=models.SET_NULL, null=True, related_name='orders', verbose_name=_("User")) + user_display = models.CharField(max_length=128, verbose_name=_("User display name")) + title = models.CharField(max_length=256, verbose_name=_("Title")) body = models.TextField(verbose_name=_("Body")) + assignees = models.ManyToManyField('users.User', related_name='assign_orders', verbose_name=_("Assignees")) + assignees_display = models.CharField(max_length=128, verbose_name=_("Assignees display name"), blank=True) type = models.CharField(choices=TYPE_CHOICES, max_length=64) status = models.CharField(choices=STATUS_CHOICES, max_length=16) + class Meta: + ordering = ('date_created',) +