Skip to content

Commit

Permalink
Merge pull request #39 from charleszlu/master
Browse files Browse the repository at this point in the history
Fix Django 4.0 deprecations
  • Loading branch information
chhantyal authored Nov 11, 2021
2 parents faa4cd8 + 62efc70 commit cb5effa
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ And you probably want auto-complete/auto-suggest feature when user types some ch

Features
--------
* Supports Django 1.8.x and Django 1.9.x
* Supports Django >= 2.2
* Supports >=Python2.7 and >=Python3.4
* Simple installation, selectize.js 0.12.1 included
* Will use jQuery install included in Django admin, no installation of jQuery needed
Expand Down
14 changes: 7 additions & 7 deletions example_app/example_app/urls.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
"""example_app URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
https://docs.djangoproject.com/en/stable/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
1. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.conf.urls import include, url
from django.urls import include, path
from django.contrib import admin

urlpatterns = [
url(r'^taggit/', include('taggit_selectize.urls')),
url(r'^admin/', include(admin.site.urls)),
path('taggit/', include('taggit_selectize.urls')),
path('admin/', include(admin.site.urls)),
]
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
django>=1.8.8
django>=2.2
django-taggit>=0.18.0
1 change: 1 addition & 0 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
'tests',
],
MIDDLEWARE_CLASSES=[],
ROOT_URLCONF='taggit_selectize.urls',
)


Expand Down
4 changes: 2 additions & 2 deletions taggit_selectize/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.conf.urls import *
from django.urls import path

from .views import get_tags_recommendation

urlpatterns = [
url(r'^$', get_tags_recommendation, name='tags_recommendation'),
path('', get_tags_recommendation, name='tags_recommendation'),
]
4 changes: 2 additions & 2 deletions taggit_selectize/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Miscellaneous utilities
import six
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from taggit.utils import split_strip
from .conf import settings

Expand All @@ -20,7 +20,7 @@ def parse_tags(tagstring):
if not tagstring:
return []

tagstring = force_text(tagstring)
tagstring = force_str(tagstring)

words = []
buffer = []
Expand Down
6 changes: 2 additions & 4 deletions taggit_selectize/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@

from .conf import settings

try:
from django.urls import reverse # Django 1.10+
except ImportError:
from django.core.urlresolvers import reverse
from django.urls import reverse


def bool_or_str(val):
if val == True:
Expand Down
9 changes: 9 additions & 0 deletions tests/test_urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django.test import TestCase
from django.urls import reverse


class TestUrls(TestCase):
def test_urls(self):
response = self.client.get(reverse('tags_recommendation'))
self.assertEqual(response.status_code, 200)
self.assertEqual(response.request['PATH_INFO'], '/')

0 comments on commit cb5effa

Please sign in to comment.