|
2 | 2 |
|
3 | 3 | from cspreports.models import get_report_model |
4 | 4 |
|
5 | | - |
6 | 5 | CSPReport = get_report_model() |
7 | 6 |
|
8 | 7 |
|
9 | 8 | class CSPReportAdmin(admin.ModelAdmin): |
10 | | - list_display = ('id', 'created', 'document_uri', 'blocked_uri') |
11 | | - fields = ('created', 'modified', 'json_as_html') |
12 | | - readonly_fields = ('created', 'modified', 'json_as_html') |
| 9 | + list_display = ("id", "created", "document_uri", "blocked_uri") |
| 10 | + fields = ("created", "modified", "json_as_html") |
| 11 | + readonly_fields = ("created", "modified", "json_as_html") |
13 | 12 |
|
14 | 13 | def json_as_html(self, instance): |
15 | 14 | return "<br />" + instance.json_as_html() |
16 | 15 |
|
17 | 16 | def document_uri(self, instance): |
18 | | - return instance.data.get('csp-report', {}).get('document-uri') |
| 17 | + return instance.data.get("csp-report", {}).get("document-uri") |
19 | 18 |
|
20 | 19 | def blocked_uri(self, instance): |
21 | | - return instance.data.get('csp-report', {}).get('blocked-uri') |
| 20 | + return instance.data.get("csp-report", {}).get("blocked-uri") |
22 | 21 |
|
23 | 22 | json_as_html.short_description = "Report" |
24 | 23 | json_as_html.allow_tags = True |
|
0 commit comments