From 7773c30240364416461c48d91e864ad0937bd6f1 Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 20 Dec 2018 10:40:52 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E5=A2=9E=E5=8A=A0=E7=B4=A2=E5=BC=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/models/node.py | 1 - apps/ops/migrations/0005_auto_20181219_1807.py | 13 +++++++++++++ apps/ops/models/adhoc.py | 2 +- apps/ops/models/celery.py | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/apps/assets/models/node.py b/apps/assets/models/node.py index 78a69c8ed..881b041d7 100644 --- a/apps/assets/models/node.py +++ b/apps/assets/models/node.py @@ -29,7 +29,6 @@ class Node(OrgModelMixin): class Meta: verbose_name = _("Node") - ordering = ('key',) def __str__(self): return self.full_value diff --git a/apps/ops/migrations/0005_auto_20181219_1807.py b/apps/ops/migrations/0005_auto_20181219_1807.py index 68daf83f7..44442013f 100644 --- a/apps/ops/migrations/0005_auto_20181219_1807.py +++ b/apps/ops/migrations/0005_auto_20181219_1807.py @@ -15,4 +15,17 @@ class Migration(migrations.Migration): name='date_created', field=models.DateTimeField(auto_now_add=True, db_index=True), ), + migrations.AlterField( + model_name='adhoc', + name='date_created', + field=models.DateTimeField(auto_now_add=True, db_index=True), + ), + migrations.AlterField( + model_name='celerytask', + name='status', + field=models.CharField( + choices=[('waiting', 'waiting'), ('running', 'running'), + ('finished', 'finished')], db_index=True, + max_length=128), + ), ] diff --git a/apps/ops/models/adhoc.py b/apps/ops/models/adhoc.py index f51f5d8be..3e119c98f 100644 --- a/apps/ops/models/adhoc.py +++ b/apps/ops/models/adhoc.py @@ -164,7 +164,7 @@ class AdHoc(models.Model): run_as = models.ForeignKey('assets.SystemUser', null=True, on_delete=models.CASCADE) _become = models.CharField(max_length=1024, default='', verbose_name=_("Become")) created_by = models.CharField(max_length=64, default='', null=True, verbose_name=_('Create by')) - date_created = models.DateTimeField(auto_now_add=True) + date_created = models.DateTimeField(auto_now_add=True, db_index=True) @property def tasks(self): diff --git a/apps/ops/models/celery.py b/apps/ops/models/celery.py index c7201b553..51412988c 100644 --- a/apps/ops/models/celery.py +++ b/apps/ops/models/celery.py @@ -19,7 +19,7 @@ class CeleryTask(models.Model): ) id = models.UUIDField(primary_key=True, default=uuid.uuid4) name = models.CharField(max_length=1024) - status = models.CharField(max_length=128, choices=STATUS_CHOICES) + status = models.CharField(max_length=128, choices=STATUS_CHOICES, db_index=True) log_path = models.CharField(max_length=256, blank=True, null=True) date_published = models.DateTimeField(auto_now_add=True) date_start = models.DateTimeField(null=True)