Skip to content

Commit

Permalink
Upgrade Django 2.2/3.2 Py3.9
Browse files Browse the repository at this point in the history
alextreme committed Mar 31, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent f26ebb7 commit 21897d7
Showing 4 changed files with 8 additions and 12 deletions.
5 changes: 2 additions & 3 deletions regex_redirects/actions.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@
import csv

from django.http import HttpResponse
import six


# Admin action for a generic "CSV Export"
@@ -31,13 +30,13 @@ def export_as_csv(modeladmin, request, queryset):
field_names = field_names - excludeset

response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename=%s.csv' % six.text_type(opts).replace('.', '_')
response['Content-Disposition'] = 'attachment; filename=%s.csv' % opts.replace('.', '_')

writer = csv.writer(response)
if header:
writer.writerow(list(field_names))
for obj in queryset:
writer.writerow([six.text_type(getattr(obj, field)).encode('utf-8', 'replace') for field in field_names])
writer.writerow([getattr(obj, field).encode('utf-8', 'replace') for field in field_names])
return response
export_as_csv.short_description = description
return export_as_csv
3 changes: 1 addition & 2 deletions regex_redirects/tests.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings
from django.utils import six
from django.core.cache import cache

from .models import Redirect
@@ -21,7 +20,7 @@ def setUp(self):
def test_model(self):
r1 = Redirect.objects.create(
old_path='/initial', new_path='/new_target')
self.assertEqual(six.text_type(r1), "/initial ---> /new_target")
self.assertEqual(str(r1) , "/initial ---> /new_target")

def test_redirect(self):
redirect = Redirect.objects.create(
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@

setup(
name='django-regex-redirects',
version='0.3.1',
version='0.4.0',
author=u'Alex de Landgraaf',
author_email='[email protected]',
packages=find_packages(),
10 changes: 4 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
[tox]
envlist =
{py27,py34,py35}-django-1.10
{py27,py34,py35,py36}-django-1.11
{py35,py36}-django-2.0
{py39}-django-2.2
{py39}-django-3.2
skip_missing_interpreters = true

[testenv]
deps=
django-1.10: Django>=1.10,<1.11
django-1.11: Django>=1.11,<2.0
django-2.0: Django>=2.0,<2.1
django-2.2: Django>=2.0,<2.3
django-3.2: Django>=3.0,<3.3
master: https://github.com/django/django/archive/master.tar.gz
coverage
coveralls

0 comments on commit 21897d7

Please sign in to comment.