From 9dc2255894670fa6bda6269f895fb29a3e625a1e Mon Sep 17 00:00:00 2001 From: Bai Date: Fri, 23 Oct 2020 16:05:18 +0800 Subject: [PATCH] =?UTF-8?q?feat(application):=20=E4=BF=AE=E6=94=B9Applicat?= =?UTF-8?q?ion=20Model=E7=9A=84domain=E5=AD=97=E6=AE=B5=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/applications/migrations/0006_application.py | 1 + apps/applications/models/application.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/applications/migrations/0006_application.py b/apps/applications/migrations/0006_application.py index a8fe2b4f2..f2b6e9dee 100644 --- a/apps/applications/migrations/0006_application.py +++ b/apps/applications/migrations/0006_application.py @@ -130,6 +130,7 @@ class Migration(migrations.Migration): ('attrs', django_mysql.models.JSONField(default=dict)), ('comment', models.TextField(blank=True, default='', max_length=128, verbose_name='Comment')), ('domain', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='assets.Domain')), + ('domain', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='applications', to='assets.Domain', verbose_name='Domain')), ], options={ 'ordering': ('name',), diff --git a/apps/applications/models/application.py b/apps/applications/models/application.py index 4c8e16a93..9984bd914 100644 --- a/apps/applications/models/application.py +++ b/apps/applications/models/application.py @@ -101,7 +101,7 @@ class Category(ChoiceSet): class Application(CommonModelMixin, OrgModelMixin): name = models.CharField(max_length=128, verbose_name=_('Name')) - domain = models.ForeignKey('assets.Domain', on_delete=models.SET_NULL, null=True, default=None) + domain = models.ForeignKey('assets.Domain', null=True, blank=True, related_name='applications', verbose_name=_("Domain"), on_delete=models.SET_NULL) category = models.CharField(max_length=16, choices=Category.choices, verbose_name=_('Category')) type = models.CharField(max_length=16, choices=Category.get_all_type_choices(), verbose_name=_('Type')) attrs = JSONField()