20
20
@admin .register (PrivateKey )
21
21
class PrivateKeyAdmin (admin .ModelAdmin ):
22
22
"""Admin class for the PrivateKey model."""
23
+
23
24
form = PrivateKeyForm
24
25
list_display = ("name" , "valid_from" , "valid_to" , "serial_number" , "download_key" )
25
26
@@ -38,6 +39,7 @@ def download_key(obj):
38
39
@admin .register (PublicCertificate )
39
40
class PublicCertificateAdmin (admin .ModelAdmin ):
40
41
"""Admin class for the PublicCertificate model."""
42
+
41
43
form = PublicCertificateForm
42
44
list_display = ("name" , "valid_from" , "valid_to" , "serial_number" , "download_cert" )
43
45
@@ -56,6 +58,7 @@ def download_cert(obj):
56
58
@admin .register (Partner )
57
59
class PartnerAdmin (admin .ModelAdmin ):
58
60
"""Admin class for the Partner model."""
61
+
59
62
form = PartnerForm
60
63
list_display = [
61
64
"name" ,
@@ -127,7 +130,7 @@ class PartnerAdmin(admin.ModelAdmin):
127
130
actions = ["send_message" ]
128
131
129
132
@staticmethod
130
- def send_message (request , queryset ):
133
+ def send_message (request , queryset ): # pylint: disable=W0613
131
134
"""Send the message to the first partner chosen by the user."""
132
135
partner = queryset .first ()
133
136
return HttpResponseRedirect (
@@ -140,13 +143,15 @@ def send_message(request, queryset):
140
143
@admin .register (Organization )
141
144
class OrganizationAdmin (admin .ModelAdmin ):
142
145
"""Admin class for the Organization model."""
146
+
143
147
list_display = ["name" , "as2_name" ]
144
148
list_filter = ("name" , "as2_name" )
145
149
146
150
147
151
@admin .register (Message )
148
152
class MessageAdmin (admin .ModelAdmin ):
149
153
"""Admin class for the Message model."""
154
+
150
155
search_fields = ("message_id" , "payload" )
151
156
152
157
list_filter = ("direction" , "status" , "organization__as2_name" , "partner__as2_name" )
@@ -170,7 +175,7 @@ def mdn_url(obj):
170
175
"""Return the URL to the related MDN if present for the message."""
171
176
if hasattr (obj , "mdn" ):
172
177
view_url = reverse_lazy (
173
- f"admin:{ Mdn ._meta .app_label } _{ Mdn ._meta .model_name } _change" ,
178
+ f"admin:{ Mdn ._meta .app_label } _{ Mdn ._meta .model_name } _change" , # pylint: disable=W0212
174
179
args = [obj .mdn .id ],
175
180
)
176
181
return format_html ('<a href="{}" class="">{}</a>' , view_url , obj .mdn .mdn_id )
@@ -199,6 +204,7 @@ def has_add_permission(self, request):
199
204
@admin .register (Mdn )
200
205
class MdnAdmin (admin .ModelAdmin ):
201
206
"""Admin class for the Mdn model."""
207
+
202
208
search_fields = (
203
209
"mdn_id" ,
204
210
"message__message_id" ,
0 commit comments