Skip to content

Commit

Permalink
Remove patterns('', as it's deprecated in django 1.9 and was causing …
Browse files Browse the repository at this point in the history
…errors in the unittest. Fixes #268.
  • Loading branch information
icatalina authored and spectras committed Dec 13, 2015
1 parent e7e09e8 commit 01ee36a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions docs/public/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Fixes:

- REST framework translation support now uses ``update_fields`` to reduce the number of queries
when updating an object.
- Admin no longer uses deprecated ``patterns`` function — :issue:`268`.

.. release 1.4.0
Expand Down
12 changes: 6 additions & 6 deletions hvad/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ def get_url(self, obj, lang=None, get={}):


def get_urls(self):
from django.conf.urls import patterns, url
from django.conf.urls import url
urlpatterns = super(TranslatableAdmin, self).get_urls()
info = self.model._meta.app_label, self.model._meta.model_name
return patterns('',
return [
url(r'^(.+)/delete-translation/(.+)/$',
self.admin_site.admin_view(self.delete_translation),
name='%s_%s_delete_translation' % info),
) + urlpatterns
] + urlpatterns

def get_form(self, request, obj=None, **kwargs):
"""
Expand Down Expand Up @@ -383,16 +383,16 @@ def get_formset(self, request, obj=None, **kwargs):
return translatable_inlineformset_factory(language, self.parent_model, self.model, **defaults)

def get_urls(self):
from django.conf.urls import patterns, url
from django.conf.urls import url
urlpatterns = super(InlineModelAdmin, self).get_urls()

info = self.model._meta.app_label, self.model._meta.module_name

return patterns('',
return [
url(r'^(.+)/delete-translation/(.+)/$',
self.admin_site.admin_view(self.delete_translation),
name='%s_%s_delete_translation' % info),
) + urlpatterns
] + urlpatterns

def get_form(self, request, obj=None, **kwargs):
"""
Expand Down
8 changes: 4 additions & 4 deletions hvad/test_utils/project/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from django.conf.urls import patterns, include
from django.conf.urls import include, url
from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)),
)
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
]

0 comments on commit 01ee36a

Please sign in to comment.