-
Notifications
You must be signed in to change notification settings - Fork 27
/
reports.py
64 lines (58 loc) · 1.44 KB
/
reports.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
from core.common.constants import HEAD
from core.reports.models import AbstractReport
from core.sources.models import Source
class SourceReport(AbstractReport):
queryset = Source.objects.filter(version=HEAD)
name = 'Sources'
id = 'sources'
select_related = ['created_by', 'organization', 'user']
verbose_fields = [
'mnemonic',
'name',
"source_type",
"public_access",
'created_by.username',
'created_at',
'parent_resource_type',
'parent_resource',
'canonical_url',
'custom_validation_schema'
]
VERBOSE_HEADERS = [
"ID",
"Name",
"Source Type",
"Public Access",
"Created By",
"Created At",
"Owner Type",
"Owner",
"Canonical URL",
"Validation Schema"
]
@property
def retired(self):
return self.NA
class SourceVersionReport(AbstractReport):
queryset = Source.objects.exclude(version=HEAD)
name = 'Source Versions'
id = 'source_versions'
note = 'Excludes HEAD versions'
select_related = ['created_by']
verbose_fields = [
'version',
'versioned_object_url',
'created_by.username',
'created_at',
'released'
]
VERBOSE_HEADERS = [
"Version",
"Source URL",
"Created By",
"Created At",
"Released"
]
@property
def retired(self):
return self.NA