X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/c2e8051452fa55db096553cbe5ae622fc363d481..a4d28c35907d5b4e4a3c4bd0ae289d00afdec69d:/src/contact/admin.py?ds=sidebyside diff --git a/src/contact/admin.py b/src/contact/admin.py index 32d12ec27..98413f34c 100644 --- a/src/contact/admin.py +++ b/src/contact/admin.py @@ -1,3 +1,6 @@ +# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# import csv import json @@ -19,8 +22,7 @@ class ContactAdminMeta(admin.ModelAdmin.__class__): raise AttributeError(name) -class ContactAdmin(admin.ModelAdmin): - __metaclass__ = ContactAdminMeta +class ContactAdmin(admin.ModelAdmin, metaclass=ContactAdminMeta): date_hierarchy = 'created_at' list_display = ['created_at', 'contact', 'form_tag'] + \ ["admin_list_%d" % i for i in range(admin_list_width)] @@ -54,7 +56,7 @@ class ContactAdmin(admin.ModelAdmin): else: # Create readonly fields from the body JSON. attachments = list(instance.attachment_set.all()) - body_keys = body.keys() + [a.tag for a in attachments] + body_keys = list(body.keys()) + [a.tag for a in attachments] # Find the original form. try: