Skip to content

Commit

Permalink
Merge pull request #259 from crucialfelix/feature/fix-six-py2-import
Browse files Browse the repository at this point in the history
Feature/fix six py2 import
  • Loading branch information
crucialfelix authored Feb 11, 2020
2 parents cc5b136 + 2b64357 commit df4f675
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 30 deletions.
9 changes: 7 additions & 2 deletions ajax_select/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import json
import sys
from six import text_type

from ajax_select.registry import registry
from django import forms
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
Expand All @@ -14,7 +15,11 @@
from django.utils.module_loading import import_string
from django.utils.safestring import mark_safe

from ajax_select.registry import registry
try:
from six import text_type
except ImportError:
from django.utils.six import text_type


if sys.version_info.major >= 3:
from django.utils.translation import gettext as _
Expand Down
10 changes: 5 additions & 5 deletions ajax_select/static/ajax_select/css/ajax_select.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
padding: 0.25em 0;
}
form .aligned .results_on_deck {
padding-left: 38px;
margin-left: 7em;
padding-left: 14px;
margin-left: 160px;
}
.results_on_deck > div {
margin-bottom: 0.5em;
margin: 0.5em 0;
}
.ui-autocomplete-loading {
background: url('../images/loading-indicator.gif') no-repeat;
background: url("../images/loading-indicator.gif") no-repeat;
background-origin: content-box;
background-position: right;
}
ul.ui-autocomplete {
/*
/*
this is the dropdown menu.
if max-width is not set and you are using django-admin
Expand Down
10 changes: 7 additions & 3 deletions example/example/lookups.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
from __future__ import unicode_literals

import ajax_select
from ajax_select import LookupChannel
from django.db.models import Q
from django.utils.html import escape
from django.utils.six import text_type

from example.models import Group, Person, Song

import ajax_select
from ajax_select import LookupChannel
try:
from six import text_type
except ImportError:
from django.utils.six import text_type


class PersonLookup(LookupChannel):
Expand Down
33 changes: 13 additions & 20 deletions example/example/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@


DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
# ('Your Name', '[email protected]'),
Expand Down Expand Up @@ -122,32 +121,26 @@

ROOT_URLCONF = 'example.urls'

# Django < 1.8
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates"
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
ROOT_URLCONF = "example.urls"

# Django >= 1.8
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [
# insert your TEMPLATE_DIRS here
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
# Insert your TEMPLATE_CONTEXT_PROCESSORS here or use this
# list if you haven't customized them:
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
"django.contrib.auth.context_processors.auth",
"django.template.context_processors.debug",
"django.template.context_processors.i18n",
"django.template.context_processors.media",
"django.template.context_processors.static",
"django.template.context_processors.tz",
"django.contrib.messages.context_processors.messages",
],
},
# TEMPLATE_LOADERS = (
Expand Down

0 comments on commit df4f675

Please sign in to comment.