-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
filters.py
46 lines (38 loc) · 1.2 KB
/
filters.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from django_filters import rest_framework as filters
from sql.models import Users, Instance, SqlWorkflowContent, WorkflowAudit
class UserFilter(filters.FilterSet):
class Meta:
model = Users
fields = {
"id": ["exact"],
"username": ["exact"],
}
class InstanceFilter(filters.FilterSet):
class Meta:
model = Instance
fields = {
"id": ["exact"],
"instance_name": ["icontains"],
"db_type": ["exact"],
"host": ["exact"],
}
class WorkflowFilter(filters.FilterSet):
class Meta:
model = SqlWorkflowContent
fields = {
"id": ["exact"],
"workflow_id": ["exact"],
"workflow__workflow_name": ["icontains"],
"workflow__instance_id": ["exact"],
"workflow__db_name": ["exact"],
"workflow__engineer": ["exact"],
"workflow__status": ["exact"],
"workflow__create_time": ["lt", "gte"],
}
class WorkflowAuditFilter(filters.FilterSet):
class Meta:
model = WorkflowAudit
fields = {
"workflow_title": ["icontains"],
"workflow_type": ["exact"],
}