Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed django.utils.six intead directly imported six #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dal/test/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.utils import six

from splinter import Browser
Expand Down
4 changes: 2 additions & 2 deletions src/dal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from django.contrib.auth import get_permission_codename
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponseBadRequest, HttpResponseNotAllowed
from django.utils import six
import six
from django.views.generic.list import BaseListView


Expand Down Expand Up @@ -104,7 +104,7 @@ def create_object(self, text):
def has_add_permission(self, request):
"""Return True if the user has the permission to add a model."""
if django.VERSION < (2, 0, 0):
auth = request.user.is_authenticated()
auth = request.user.is_authenticated
else:
auth = request.user.is_authenticated

Expand Down
4 changes: 2 additions & 2 deletions src/dal/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse
from django.utils import six
from django.urls import reverse
import six
from django.utils.safestring import mark_safe


Expand Down
2 changes: 1 addition & 1 deletion src/dal_contenttypes/fields.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Model choice fields that take a ContentType too: for generic relations."""

from django.contrib.contenttypes.models import ContentType
from django.utils import six
import six


class ContentTypeModelFieldMixin(object):
Expand Down
4 changes: 2 additions & 2 deletions src/dal_queryset_sequence/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from django import forms
from django.contrib.contenttypes.models import ContentType
from django.conf.urls import url
from django.urls import re_path

from queryset_sequence import QuerySetSequence

Expand Down Expand Up @@ -162,5 +162,5 @@ def as_url(self, form):

AutoView = type('Autoview{}{}'.format(form.__name__, self.field_id),
(self.view_obj,), {})
return url(r'^{}_{}_autocomp$'.format(form.__name__, self.field_id),
return re_path(r'^{}_{}_autocomp$'.format(form.__name__, self.field_id),
AutoView.as_view(queryset=self.queryset), name=url_name)
2 changes: 1 addition & 1 deletion src/dal_queryset_sequence/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from django import forms
from django.contrib.contenttypes.models import ContentType
from django.utils import six
import six


class QuerySetSequenceSelectMixin(WidgetMixin):
Expand Down
4 changes: 2 additions & 2 deletions src/dal_select2/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

from django import http
from django.core.exceptions import ImproperlyConfigured
from django.utils import six
from django.utils.translation import ugettext as _
import six
from django.utils.translation import gettext as _
from django.views.generic.list import View


Expand Down
2 changes: 1 addition & 1 deletion src/dal_select2/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from django.contrib.admin.widgets import SELECT2_TRANSLATIONS
except ImportError:
SELECT2_TRANSLATIONS = {}
from django.utils import six
import six
from django.utils import translation


Expand Down
4 changes: 2 additions & 2 deletions src/dal_select2_queryset_sequence/fields.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.conf.urls import url
from django.urls import re_path

from dal_queryset_sequence.fields import QuerySetSequenceModelField

Expand Down Expand Up @@ -44,5 +44,5 @@ def as_url(self, form):
(Select2QuerySetSequenceAutoView,),
{'model_choice': self.model_choice}) # send to the view the model and filter list

return url(r'^{}_{}_autocomp$'.format(form.__name__, self.field_id),
return re_path(r'^{}_{}_autocomp$'.format(form.__name__, self.field_id),
AutoView.as_view(), name=url_name)
2 changes: 1 addition & 1 deletion src/dal_select2_queryset_sequence/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from queryset_sequence import QuerySetSequence

from django.template.defaultfilters import capfirst
from django.utils import six
import six
from django.db.models import Q

from functools import reduce
Expand Down
2 changes: 1 addition & 1 deletion src/dal_select2_taggit/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from dal_select2.widgets import TagSelect2

from django import VERSION
from django.utils import six
import six


class TaggitSelect2(TagSelect2):
Expand Down
1 change: 0 additions & 1 deletion test_project/custom_select2/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'custom_select2.apps.TestApp'
2 changes: 1 addition & 1 deletion test_project/custom_select2/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class TestInline(admin.TabularInline):
fk_name = 'for_inline'


@admin.register(TModel)
class TestAdmin(admin.ModelAdmin):
form = TForm
inlines = [TestInline]
admin.site.register(TModel, TestAdmin)
6 changes: 3 additions & 3 deletions test_project/custom_select2/urls.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from dal import autocomplete

from django.conf.urls import url
from django.urls import path

from .models import TModel


urlpatterns = [
url(
'test-autocomplete/$',
path(
'test-autocomplete/',
autocomplete.Select2QuerySetView.as_view(model=TModel),
name='select2_fk',
),
Expand Down
2 changes: 1 addition & 1 deletion test_project/forward_different_fields/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class TestInline(admin.TabularInline):
fk_name = 'for_inline'


@admin.register(TModel)
class TestAdmin(admin.ModelAdmin):
form = TForm

admin.site.register(TModel, TestAdmin)
6 changes: 3 additions & 3 deletions test_project/forward_different_fields/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from dal import autocomplete

from django.conf.urls import url
from django.urls import path


class ListWithForwardsView(autocomplete.Select2ListView):
Expand All @@ -19,8 +19,8 @@ def get_list(self):


urlpatterns = [
url(
'^forward_different_fields/$',
path(
'forward_different_fields/',
ListWithForwardsView.as_view(),
name='forward_different_fields'
),
Expand Down
1 change: 0 additions & 1 deletion test_project/linked_data/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'linked_data.apps.TestApp'
2 changes: 1 addition & 1 deletion test_project/linked_data/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class TestInline(admin.TabularInline):
fk_name = 'for_inline'


@admin.register(TModel)
class TestAdmin(admin.ModelAdmin):
form = TForm
inlines = [TestInline]
admin.site.register(TModel, TestAdmin)
10 changes: 5 additions & 5 deletions test_project/linked_data/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse
from django.utils.encoding import force_text
from django.urls import reverse
from django.utils.encoding import force_str

from .models import TModel
from .urls import LinkedDataView
Expand All @@ -24,7 +24,7 @@ def test_no_data(self):

response = LinkedDataView.as_view(model=TModel)(request)
self.assertEqual(response.status_code, 200)
self.assertJSONEqual(force_text(response.content),
self.assertJSONEqual(force_str(response.content),
'{"results": [], "pagination": {"more": false}}')

def test_not_dict(self):
Expand All @@ -34,7 +34,7 @@ def test_not_dict(self):

response = LinkedDataView.as_view(model=TModel)(request)
self.assertEqual(response.status_code, 400)
self.assertEqual(force_text(response.content), 'Not a JSON object')
self.assertEqual(force_str(response.content), 'Not a JSON object')

def test_invalid_json(self):
request = self.factory.get(
Expand All @@ -43,7 +43,7 @@ def test_invalid_json(self):

response = LinkedDataView.as_view(model=TModel)(request)
self.assertEqual(response.status_code, 400)
self.assertEqual(force_text(response.content), 'Invalid JSON data')
self.assertEqual(force_str(response.content), 'Invalid JSON data')

def test_invalid_method(self):
request = self.factory.put(reverse('linked_data'))
Expand Down
6 changes: 3 additions & 3 deletions test_project/linked_data/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from dal import autocomplete

from django.conf.urls import url
from django.urls import path

from .models import TModel

Expand All @@ -17,8 +17,8 @@ def get_queryset(self):


urlpatterns = [
url(
'^linked_data/$',
path(
'linked_data/',
LinkedDataView.as_view(model=TModel),
name='linked_data'
),
Expand Down
1 change: 0 additions & 1 deletion test_project/rename_forward/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'rename_forward.apps.TestApp'
2 changes: 1 addition & 1 deletion test_project/rename_forward/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class TestInline(admin.TabularInline):
fk_name = 'for_inline'


@admin.register(TModel)
class TestAdmin(admin.ModelAdmin):
form = TForm
inlines = [TestInline]
admin.site.register(TModel, TestAdmin)
6 changes: 3 additions & 3 deletions test_project/rename_forward/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from dal import autocomplete

from django.conf.urls import url
from django.urls import path

from .models import TModel

Expand All @@ -22,8 +22,8 @@ def get_queryset(self):


urlpatterns = [
url(
'^linked_data/$',
path(
'linked_data/',
LinkedDataView.as_view(model=TModel),
name='linked_data_rf'
),
Expand Down
1 change: 0 additions & 1 deletion test_project/secure_data/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'secure_data.apps.TestApp'
2 changes: 1 addition & 1 deletion test_project/secure_data/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class TestInline(SecureFormMixin, admin.TabularInline):
form = TForm


@admin.register(TModel)
class TestAdmin(SecureFormMixin, admin.ModelAdmin):
inlines = [TestInline]
form = TForm
admin.site.register(TModel, TestAdmin)
6 changes: 3 additions & 3 deletions test_project/secure_data/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from dal import autocomplete

from django.conf.urls import url
from django.urls import path

from .models import TModel

Expand All @@ -11,8 +11,8 @@ def get_queryset(self):


urlpatterns = [
url(
'^secure-data/$',
path(
'secure-data/',
SecureDataView.as_view(),
name='secure_data',
),
Expand Down
1 change: 0 additions & 1 deletion test_project/select2_foreign_key/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'select2_foreign_key.apps.TestApp'
2 changes: 1 addition & 1 deletion test_project/select2_foreign_key/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class TestInline(admin.TabularInline):
fk_name = 'for_inline'


@admin.register(TModel)
class TestAdmin(admin.ModelAdmin):
form = TForm
inlines = [TestInline]
admin.site.register(TModel, TestAdmin)
6 changes: 3 additions & 3 deletions test_project/select2_foreign_key/urls.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from dal import autocomplete

from django.conf.urls import url
from django.urls import path

from .models import TModel


urlpatterns = [
url(
'test-autocomplete/$',
path(
'test-autocomplete/',
autocomplete.Select2QuerySetView.as_view(model=TModel),
name='select2_fk',
),
Expand Down
1 change: 0 additions & 1 deletion test_project/select2_generic_foreign_key/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'select2_generic_foreign_key.apps.TestApp'
2 changes: 1 addition & 1 deletion test_project/select2_generic_foreign_key/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class TestInline(admin.TabularInline):
fk_name = 'for_inline'


@admin.register(TModel)
class TestAdmin(admin.ModelAdmin):
form = TForm
inlines = [TestInline]
admin.site.register(TModel, TestAdmin)
4 changes: 2 additions & 2 deletions test_project/select2_generic_foreign_key/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse
from django.utils import six
from django.urls import reverse
import six

from queryset_sequence import QuerySetSequence

Expand Down
6 changes: 3 additions & 3 deletions test_project/select2_generic_foreign_key/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from dal import autocomplete

from django.conf.urls import url
from django.urls import path
from django.contrib.auth.models import Group
from django.views import generic

Expand All @@ -9,8 +9,8 @@


urlpatterns = [
url(
'test/(?P<pk>\d+)/$',
path(
'test/<int:pk>/',
generic.UpdateView.as_view(
model=TModel,
form_class=TForm,
Expand Down
1 change: 0 additions & 1 deletion test_project/select2_generic_m2m/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'select2_generic_m2m.apps.TestApp'
2 changes: 1 addition & 1 deletion test_project/select2_generic_m2m/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class TestInline(admin.TabularInline):
fk_name = 'for_inline'


@admin.register(TModel)
class TestAdmin(admin.ModelAdmin):
form = TForm
inlines = [TestInline]
admin.site.register(TModel, TestAdmin)
4 changes: 2 additions & 2 deletions test_project/select2_generic_m2m/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse
from django.utils import six
from django.urls import reverse
import six

from queryset_sequence import QuerySetSequence

Expand Down
Loading