|
12 | 12 |
|
13 | 13 | @admin.register(DrefFile) |
14 | 14 | class DrefFileAdmin(admin.ModelAdmin): |
15 | | - search_fields = ('file',) |
| 15 | + search_fields = ("file",) |
16 | 16 |
|
17 | 17 |
|
18 | 18 | @admin.register(Dref) |
19 | 19 | class DrefAdmin(CompareVersionAdmin, TranslationAdmin, admin.ModelAdmin): |
20 | | - search_fields = ('title',) |
21 | | - list_display = ('title', 'national_society', 'disaster_type', |
22 | | - 'ns_request_date', 'submission_to_geneva', 'status',) |
| 20 | + search_fields = ("title",) |
| 21 | + list_display = ( |
| 22 | + "title", |
| 23 | + "national_society", |
| 24 | + "disaster_type", |
| 25 | + "ns_request_date", |
| 26 | + "submission_to_geneva", |
| 27 | + "status", |
| 28 | + ) |
23 | 29 | autocomplete_fields = ( |
24 | | - 'national_society', |
25 | | - 'disaster_type', |
26 | | - 'users', |
27 | | - 'event_map', |
28 | | - 'images', |
29 | | - 'budget_file', |
30 | | - 'cover_image', |
| 30 | + "national_society", |
| 31 | + "disaster_type", |
| 32 | + "users", |
| 33 | + "event_map", |
| 34 | + "images", |
| 35 | + "budget_file", |
| 36 | + "cover_image", |
31 | 37 | ) |
32 | 38 |
|
33 | 39 | def get_queryset(self, request): |
34 | | - return super().get_queryset(request).prefetch_related( |
35 | | - 'planned_interventions', |
36 | | - 'needs_identified', |
37 | | - 'national_society_actions', |
38 | | - 'users' |
| 40 | + return ( |
| 41 | + super() |
| 42 | + .get_queryset(request) |
| 43 | + .prefetch_related("planned_interventions", "needs_identified", "national_society_actions", "users") |
39 | 44 | ) |
40 | 45 |
|
41 | 46 |
|
42 | 47 | @admin.register(DrefOperationalUpdate) |
43 | 48 | class DrefOperationalUpdateAdmin(CompareVersionAdmin, admin.ModelAdmin): |
44 | | - list_display = ('title', 'national_society', 'disaster_type') |
| 49 | + list_display = ("title", "national_society", "disaster_type") |
45 | 50 | autocomplete_fields = ( |
46 | | - 'national_society', |
47 | | - 'disaster_type', |
48 | | - 'images', |
49 | | - 'users', |
50 | | - 'event_map', |
51 | | - 'images', |
52 | | - 'budget_file', |
53 | | - 'cover_image', |
| 51 | + "national_society", |
| 52 | + "disaster_type", |
| 53 | + "images", |
| 54 | + "users", |
| 55 | + "event_map", |
| 56 | + "images", |
| 57 | + "budget_file", |
| 58 | + "cover_image", |
54 | 59 | ) |
55 | | - list_filter = ['dref'] |
| 60 | + list_filter = ["dref"] |
56 | 61 |
|
57 | 62 | def get_queryset(self, request): |
58 | | - return super().get_queryset(request).prefetch_related( |
59 | | - 'planned_interventions', |
60 | | - 'needs_identified', |
61 | | - 'national_society_actions', |
62 | | - 'users' |
| 63 | + return ( |
| 64 | + super() |
| 65 | + .get_queryset(request) |
| 66 | + .prefetch_related("planned_interventions", "needs_identified", "national_society_actions", "users") |
63 | 67 | ) |
64 | 68 |
|
| 69 | + |
65 | 70 | @admin.register(DrefFinalReport) |
66 | 71 | class DrefFinalReportAdmin(CompareVersionAdmin, admin.ModelAdmin): |
67 | | - list_display = ('title', 'national_society', 'disaster_type') |
| 72 | + list_display = ("title", "national_society", "disaster_type") |
68 | 73 | autocomplete_fields = ( |
69 | | - 'national_society', |
70 | | - 'disaster_type', |
71 | | - 'photos', |
| 74 | + "national_society", |
| 75 | + "disaster_type", |
| 76 | + "photos", |
72 | 77 | ) |
73 | | - list_filter = ['dref'] |
74 | | - search_fields = ['title', 'national_society__name'] |
| 78 | + list_filter = ["dref"] |
| 79 | + search_fields = ["title", "national_society__name"] |
0 commit comments