Skip to content

Commit

Permalink
Merge branch 'release/v3.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
wolph committed Aug 10, 2016
2 parents 8a470fe + 5f06491 commit 5f5f279
Show file tree
Hide file tree
Showing 12 changed files with 79 additions and 77 deletions.
39 changes: 25 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,38 @@
sudo: false
language: python
python: 2.7
cache: pip

env:
- TOX_ENV=py27-django18
- TOX_ENV=py27-django18
- TOX_ENV=py27-django18
- TOX_ENV=py32-django18
- TOX_ENV=py27-django19
- TOX_ENV=py27-django1a
- TOX_ENV=py33-django18
- TOX_ENV=py34-django15
- TOX_ENV=py34-django16
- TOX_ENV=py34-django18
# - TOX_ENV=pypy-django14
- TOX_ENV=pypy-django15
- TOX_ENV=pypy-django16
- TOX_ENV=py34-django19
- TOX_ENV=py34-django1a
- TOX_ENV=py35-django19
- TOX_ENV=py35-django1a
- TOX_ENV=pypy-django18
- TOX_ENV=pypy3-django15
- TOX_ENV=pypy3-django16
- TOX_ENV=pypy-django19
- TOX_ENV=pypy-django1a
- TOX_ENV=pypy3-django18
- TOX_ENV=coveralls

install:
pip install tox
- pip install -r requirements.txt
- pip install -r requirements_test.txt
- pip install -e .
- pip install tox
- pip install coveralls

script:
tox -e $TOX_ENV
- tox -e $TOX_ENV
- py.test

after_success:
- coveralls

notifications:
email:
on_success: never
on_failure: change

11 changes: 7 additions & 4 deletions example/autocompletionexample/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ def __repr__(self):
self.name,
)

def __unicode__(self):
# Either unicode or str is used depending on the Python version
def __unicode__(self): # pragma: no cover
return self.name

def __str__(self): # pragma: no cover
return self.name

class Meta:
Expand All @@ -37,7 +41,7 @@ class Spam(ReprModel):

def clean(self):
# We want everything tested, also calling a clean method
raise exceptions.ValidationError({'foo': 'Test Error'})
raise exceptions.ValidationError({'foo': 'Expected testing error'})


class FooExtraSpam(ReprModel):
Expand All @@ -48,8 +52,7 @@ class FooExtraSpam(ReprModel):

class ExtraSpam(ReprModel):
name = models.CharField(max_length=50, help_text='The extra spam name')
foo = models.ManyToManyField(
Foo, through=FooExtraSpam, help_text='The foo objects')
foo = models.ManyToManyField(Foo, through=FooExtraSpam)


class Egg(ReprModel):
Expand Down
Binary file modified example/database
Binary file not shown.
12 changes: 10 additions & 2 deletions example/db_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@ def get_db(self, model, **hints):

db_for_read = db_for_write = get_db

def allow_migrate(self, db, model):
return self.TABLE_MAPPINGS.get(model._meta.db_table, 'default')
def allow_migrate(self, *args, **hints):
# Django 1.8, 1.9 and 1.10 all have different behaviour... sigh
if 'model_name' in hints:
model_name = hints['model_name']
elif 'model' in hints:
model_name = hints['model']._meta.db_table
else:
model_name = args[1]._meta.db_table

return self.TABLE_MAPPINGS.get(model_name, 'default')

def allow_relation(self, obj1, obj2, **hints):
return True
Expand Down
32 changes: 15 additions & 17 deletions example/settings.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Django settings for example project.
import os
import django

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
# ('Your Name', 'your_email@example.com'),
Expand Down Expand Up @@ -87,11 +84,21 @@
# Make this unique, and don't share it with anybody.
SECRET_KEY = '8kqthvdm3hf0=cpyksli(5*z&fkr3whd4qn=d4$7qeg-ac8he4'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
Expand All @@ -110,15 +117,6 @@

TEST_RUNNER = 'django.test.runner.DiscoverRunner'

DJANGO_DIR = os.path.dirname(os.path.abspath(django.__file__))
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or
# "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
os.path.join(DJANGO_DIR, 'contrib', 'admin', 'templates'),
)

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
Expand Down
16 changes: 9 additions & 7 deletions example/urls.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from django.conf.urls import patterns, include, url
from django.conf import urls
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns(
'',
url(r'^tags_input/', include('tags_input.urls', namespace='tags_input')),
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
)

urlpatterns = [
urls.url(r'^tags_input/',
urls.include('tags_input.urls', namespace='tags_input')),
urls.url(r'^admin/doc/', urls.include('django.contrib.admindocs.urls')),
urls.url(r'^admin/', urls.include(admin.site.urls)),
]

2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ addopts =
pep8ignore =
*.py W391
docs/*.py ALL
migrations/*.py ALL

flakes-ignore =
docs/*.py ALL
migrations/*.py ALL

DJANGO_SETTINGS_MODULE=example.settings

3 changes: 1 addition & 2 deletions tags_input/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ def formfield_for_manytomany(self, db_field, request=None, **kwargs):
(db_field.name in self.filter_vertical),
)
kwargs['required'] = not db_field.blank
if hasattr(db_field, 'help_text'):
kwargs['help_text'] = db_field.help_text
kwargs['help_text'] = getattr(db_field, 'help_text', None)

# Ugly hack to stop the Django admin from adding the + icon
if db_field.name not in self.raw_id_fields:
Expand Down
2 changes: 1 addition & 1 deletion tags_input/metadata.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__package_name__ = 'django-tags-input'
__version__ = '2.1.0'
__version__ = '3.0.0'
__author__ = 'Rick van Hattem'
__author_email__ = 'Rick.van.Hattem@Fawo.nl'
__description__ = '''Django jQuery Tags Input is a Django field and widget
Expand Down
2 changes: 0 additions & 2 deletions tags_input/templates/tags_input_widget.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
//]]>
</script>

field: {{ field }}

{# django admin adds the help text. this is for use outside of the admin #}
{% block help %}{% if help_text %}<p class="help">{{help_text}}</p>{% endif %}{% endblock %}
{{ inline }}
13 changes: 6 additions & 7 deletions tags_input/urls.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from django.conf.urls import patterns, url
from django.conf import urls
from . import views


urlpatterns = patterns(
'tags_input.views',
url(r'^autocomplete/(?P<app>\w+)/(?P<model>\w+)/(?P<fields>[\w-]+)/$',
'autocomplete', name='autocomplete'),
)
urlpatterns = [
urls.url(r'^autocomplete/(?P<app>\w+)/(?P<model>\w+)/(?P<fields>[\w-]+)/$',
views.autocomplete, name='autocomplete'),
]

24 changes: 3 additions & 21 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
[tox]
install_command = pip-accel-for-tox {opts} {packages}
envlist =
coveralls,
py{26}-django{14,15,16},
py{27,py}-django{14,15,16,17,18,19,1a},
py{33,34,py3}-django{15,16,17},
py{33,34,35,py3}-django{18},
py{33,34,35}-django{19,1a}
py{27,py}-django{18,19,1a},
py{33,py3}-django18,
py{34,35}-django{19,1a},

skip_missing_interpreters = True
usedevelop = True

[testenv]
deps =
django14: Django>=1.4,<1.5
django15: Django>=1.5,<1.6
django16: Django>=1.6,<1.7
django17: Django>=1.7,<1.8
django18: Django>=1.8,<1.9
django19: Django>=1.9,<1.10
django1a: Django>=1.10,<1.11
Expand All @@ -26,14 +19,3 @@ commands =
pip freeze
python setup.py test

[testenv:coveralls]
commands =
pip freeze
python setup.py test
coveralls

deps =
Django>=1.8,<1.9
-rrequirements_test.txt
coveralls

0 comments on commit 5f5f279

Please sign in to comment.