This raises a warning in Django 1.10 and will cause an error in 2.0.
Signed-off-by: Stephen Finucane <stephen@that.guru>
LOOKUP_FIELD = 'lookup_expr'
else:
LOOKUP_FIELD = 'lookup_type'
+
+
+# reverse
+#
+# The reverse function has been moved to django.urls in Django 1.10 and
+# backwards compatible imports will be removed in Django 2.0
+
+if django.VERSION >= (1, 10):
+ from django.urls import NoReverseMatch # noqa
+ from django.urls import reverse # noqa
+else:
+ from django.core.urlresolvers import NoReverseMatch # noqa
+ from django.core.urlresolvers import reverse # noqa
from __future__ import absolute_import
from django.conf import settings
-from django.core.urlresolvers import reverse, NoReverseMatch
from django import template
from django.utils.encoding import smart_str
from django.utils.html import escape
+from patchwork.compat import reverse
+from patchwork.compat import NoReverseMatch
from patchwork.filters import filterclasses
from __future__ import absolute_import
-from django.core.urlresolvers import reverse
from django import template
from django.utils.html import escape
from django.utils.safestring import mark_safe
+from patchwork.compat import reverse
from patchwork.filters import SubmitterFilter
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from django.core.urlresolvers import reverse
from django.test import TestCase
+from patchwork.compat import reverse
+
class AboutViewTest(TestCase):
import unittest
from django.conf import settings
-from django.core.urlresolvers import reverse
from django.test import TestCase
from django.utils.http import urlencode
from django.utils import six
from django.utils.six.moves import range
from django.utils.six.moves import zip
+from patchwork.compat import reverse
from patchwork.models import Bundle
from patchwork.models import BundlePatch
from patchwork.tests.utils import create_bundle
import json
-from django.core.urlresolvers import reverse
from django.test import TestCase
from django.utils.six.moves import range
+from patchwork.compat import reverse
from patchwork.tests.utils import create_person
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from django.core.urlresolvers import reverse
from django.test import TestCase
+from patchwork.compat import reverse
from patchwork.models import EmailConfirmation
from patchwork.tests.utils import create_user
from __future__ import absolute_import
-from django.core.urlresolvers import reverse
from django.test import TestCase
+from patchwork.compat import reverse
from patchwork.tests.utils import create_comment
from patchwork.tests.utils import create_cover
from patchwork.tests.utils import create_patch
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from django.core.urlresolvers import reverse
from django.test import TestCase
+from patchwork.compat import reverse
from patchwork.tests.utils import create_person
from patchwork.tests.utils import create_patch
from patchwork.tests.utils import read_patch
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from django.core.urlresolvers import reverse
from django.test import TestCase
+from patchwork.compat import reverse
from patchwork.tests.utils import create_project
from datetime import datetime as dt
import re
-from django.core.urlresolvers import reverse
from django.test import TestCase
from django.utils.six.moves import zip
+from patchwork.compat import reverse
from patchwork.models import Patch
from patchwork.tests.utils import create_patch
from patchwork.tests.utils import create_person
import re
from django.core import mail
-from django.core.urlresolvers import reverse
from django.test import TestCase
+from patchwork.compat import reverse
from patchwork.models import EmailOptout
from patchwork.models import EmailConfirmation
from patchwork.tests.utils import create_person
import dateutil.tz
import email
-from django.core.urlresolvers import reverse
from django.test import TestCase
+from patchwork.compat import reverse
from patchwork.tests.utils import create_comment
from patchwork.tests.utils import create_patch
from patchwork.tests.utils import create_project
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from django.core.urlresolvers import reverse
from django.test import TestCase
+from patchwork.compat import reverse
from patchwork.tests.utils import create_patches
from patchwork.tests.utils import create_project
from patchwork.tests.utils import create_user
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from django.core.urlresolvers import reverse
from django.test import TestCase
+from patchwork.compat import reverse
from patchwork.tests import utils
from django.contrib.auth.models import User
from django.core import mail
-from django.core.urlresolvers import reverse
from django.test.client import Client
from django.test import TestCase
+from patchwork.compat import reverse
from patchwork.models import EmailConfirmation, Person
from patchwork.tests.utils import create_user
import unittest
from django.conf import settings
-from django.core.urlresolvers import reverse
+from patchwork.compat import reverse
from patchwork.models import Check
from patchwork.models import Patch
from patchwork.models import Project
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from django.core.urlresolvers import reverse
from django.test import TestCase
+from patchwork.compat import reverse
from patchwork.models import Patch
from patchwork.models import State
from patchwork.tests.utils import create_patches
from django.contrib.auth.models import User
from django.core import mail
-from django.core.urlresolvers import reverse
from django.test import TestCase
+from patchwork.compat import reverse
from patchwork.models import EmailConfirmation
from patchwork.models import Person
from patchwork.models import UserProfile
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from django.core.urlresolvers import reverse
-
+from patchwork.compat import reverse
from patchwork.tests.browser import SeleniumTestCase
from patchwork.tests.utils import create_user
import unittest
from django.conf import settings
-from django.core.urlresolvers import reverse
from django.test import LiveServerTestCase
from django.utils.six.moves import xmlrpc_client
+from patchwork.compat import reverse
from patchwork.tests import utils
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from django.conf import settings
-from django.core.urlresolvers import reverse
from django.http import HttpResponsePermanentRedirect
from django.shortcuts import render
+from patchwork.compat import reverse
+
def about(request):
context = {
from django.conf import settings
from django.contrib.auth.decorators import login_required
-from django.core import urlresolvers
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.http import HttpResponseNotFound
from django.shortcuts import get_object_or_404
from django.shortcuts import render
+from patchwork.compat import reverse
from patchwork.filters import DelegateFilter
from patchwork.forms import BundleForm
from patchwork.forms import DeleteBundleForm
action = request.POST.get('action', '').lower()
if action == 'delete':
bundle.delete()
- return HttpResponseRedirect(
- urlresolvers.reverse('user-profile')
- )
+ return HttpResponseRedirect(reverse('user-profile'))
elif action == 'update':
form = BundleForm(request.POST, instance=bundle)
if form.is_valid():
@login_required
def bundle_mbox_redir(request, bundle_id):
bundle = get_object_or_404(Bundle, id=bundle_id, owner=request.user)
- return HttpResponseRedirect(urlresolvers.reverse(
- 'bundle-mbox', kwargs={
- 'username': request.user.username,
- 'bundlename': bundle.name,
- }))
+ return HttpResponseRedirect(
+ reverse('bundle-mbox', kwargs={
+ 'username': request.user.username,
+ 'bundlename': bundle.name,
+ }))
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from django.core import urlresolvers
from django import http
from django import shortcuts
+from patchwork.compat import reverse
from patchwork import models
key = 'cover_id'
return http.HttpResponseRedirect('%s#%s' % (
- urlresolvers.reverse(url, kwargs={key: submission.id}),
- comment_id))
+ reverse(url, kwargs={key: submission.id}), comment_id))
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from django.core import urlresolvers
from django.http import Http404
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.shortcuts import render_to_response
+from patchwork.compat import reverse
from patchwork.models import CoverLetter
from patchwork.models import Submission
submissions = Submission.objects.filter(id=cover_id)
if submissions:
return HttpResponseRedirect(
- urlresolvers.reverse(
- 'patch-detail',
- kwargs={'patch_id': cover_id}))
+ reverse('patch-detail', kwargs={'patch_id': cover_id}))
raise exc
context = {
from django.conf import settings as conf_settings
from django.core.mail import send_mail
-from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render
from patchwork.compat import render_to_string
+from patchwork.compat import reverse
from patchwork.forms import EmailForm
from patchwork.models import EmailConfirmation
from patchwork.models import EmailOptout
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from django.contrib import messages
-from django.core import urlresolvers
from django.http import Http404
from django.http import HttpResponse
from django.http import HttpResponseForbidden
from django.shortcuts import get_object_or_404
from django.shortcuts import render
+from patchwork.compat import reverse
from patchwork.forms import CreateBundleForm
from patchwork.forms import PatchForm
from patchwork.models import Bundle
submissions = Submission.objects.filter(id=patch_id)
if submissions:
return HttpResponseRedirect(
- urlresolvers.reverse(
- 'cover-detail',
- kwargs={'cover_id': patch_id}))
+ reverse('cover-detail', kwargs={'cover_id': patch_id}))
raise exc
editable = patch.is_editable(request.user)
from django.conf import settings
from django.contrib.auth.models import User
-from django.core import urlresolvers
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.shortcuts import render
+from patchwork.compat import reverse
from patchwork.models import Patch
from patchwork.models import Project
if projects.count() == 1:
return HttpResponseRedirect(
- urlresolvers.reverse('patch-list',
- kwargs={'project_id': projects[0].linkname}))
+ reverse('patch-list',
+ kwargs={'project_id': projects[0].linkname}))
context = {
'projects': projects,
from django.contrib.sites.models import Site
from django.conf import settings
from django.core.mail import send_mail
-from django.core import urlresolvers
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.shortcuts import render
from patchwork.compat import render_to_string
+from patchwork.compat import reverse
from patchwork.filters import DelegateFilter
from patchwork.forms import EmailForm
from patchwork.forms import RegistrationForm
person.user = None
person.save()
- return HttpResponseRedirect(urlresolvers.reverse('user-profile'))
+ return HttpResponseRedirect(reverse('user-profile'))
@login_required
if len(todo_lists) == 1:
return HttpResponseRedirect(
- urlresolvers.reverse(
+ reverse(
'user-todo',
kwargs={'project_id': todo_lists[0]['project'].linkname}))
from xmlrpc.server import XMLRPCDocGenerator
import sys
-from django.core.urlresolvers import reverse
from django.contrib.auth import authenticate
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.utils.six.moves import xmlrpc_client
from django.utils.six.moves.xmlrpc_server import SimpleXMLRPCDispatcher
+from patchwork.compat import reverse
from patchwork.models import Check
from patchwork.models import Patch
from patchwork.models import Person