X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/98b2c09ef1f1c8288a31517f61423264c6b3291c..45b3f39b2548169718f640227d3c09064cdfa9cb:/src/contact/admin.py diff --git a/src/contact/admin.py b/src/contact/admin.py index af14c6b02..a05943381 100644 --- a/src/contact/admin.py +++ b/src/contact/admin.py @@ -5,7 +5,7 @@ import json from django.contrib import admin from django.utils.translation import ugettext as _ from django.utils.safestring import mark_safe -from django.conf.urls import patterns, url +from django.conf.urls import url from django.http import HttpResponse, Http404 from wolnelektury.utils import UnicodeCSVWriter @@ -104,12 +104,10 @@ class ContactAdmin(admin.ModelAdmin): return super(ContactAdmin, self).changelist_view(request, extra_context=context) def get_urls(self): - # urls = super(ContactAdmin, self).get_urls() - return patterns( - '', + return [ url(r'^extract/(?P[\w-]+)/(?P[\w-]+)/$', self.admin_site.admin_view(extract_view), name='contact_extract') - ) + super(ContactAdmin, self).get_urls() + ] + super(ContactAdmin, self).get_urls() def extract_view(request, form_tag, extract_type_slug): @@ -159,11 +157,11 @@ def extract_view(request, form_tag, extract_type_slug): for key in keys: if key not in record: record[key] = '' - if isinstance(record[key], basestring): + if isinstance(record[key], str): pass elif isinstance(record[key], bool): record[key] = 'tak' if record[key] else 'nie' - elif isinstance(record[key], (list, tuple)) and all(isinstance(v, basestring) for v in record[key]): + elif isinstance(record[key], (list, tuple)) and all(isinstance(v, str) for v in record[key]): record[key] = ', '.join(record[key]) else: record[key] = json.dumps(record[key])