feat: 修改ops api

pull/9123/head
Aaron3S 2022-11-26 03:13:06 +08:00
parent 5e503ec5b8
commit 2c8f51940a
2 changed files with 9 additions and 1 deletions

View File

@ -16,7 +16,9 @@ class JobViewSet(OrgBulkModelViewSet):
def get_queryset(self):
query_set = super().get_queryset()
return query_set.filter(instant=False)
if self.action != 'retrieve':
return query_set.filter(instant=False)
return query_set
def perform_create(self, serializer):
instance = serializer.save()

View File

@ -91,6 +91,9 @@ class Job(JMSOrgBaseModel, PeriodTaskModelMixin):
def create_execution(self):
return self.executions.create()
class Meta:
ordering = ['date_created']
class JobExecution(JMSOrgBaseModel):
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
@ -198,3 +201,6 @@ class JobExecution(JMSOrgBaseModel):
except Exception as e:
logging.error(e, exc_info=True)
self.set_error(e)
class Meta:
ordering = ['-date_created']