Skip to content

Commit

Permalink
Merge branch 'release/5.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
wolph committed May 6, 2020
2 parents a35ce3d + 144fb07 commit 95ec1bc
Show file tree
Hide file tree
Showing 13 changed files with 274 additions and 35 deletions.
7 changes: 4 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ How to install

Installing this module only takes a couple of minutes.

Currently Django 1.8, 1.9, 1.10 and 1.11, 2.1 and 2.2 are supported and tested in combination with Python 2.7, 3.2, 3.3, 3.4, 3.5, 3.6 and Pypy.
Currently Django 2.2 and 3.0 are supported and tested in combination with Python 3.5, 3.6, 3.7 and 3.8.

For Django below 2.2 and Python 2.7 up to version 4.6.0 should work.

For Django 1.4, Django 1.5, Django 1.6 and Django 1.7 in combination with
Python 2.6 and 2.7. Python 3.2, 3.3 and 3.4. Pypy and Pypy3 version 2.1.0 can
be used.


1. Install the module itself

pip install django-tags-input
Expand Down Expand Up @@ -133,7 +134,7 @@ To test the project simply clone the repository, install and run the example:
# Or even without any type of virtualenv at all
mkvirtualenv django-tags-input
git clone https://github.com/WoLpH/django-tags-input.git
# Tested with up to Django 2.1
# Tested with Django 3.0
pip install django
pip install -e 'django-tags-input[tests]'
cd django-tags-input/example
Expand Down
93 changes: 93 additions & 0 deletions example/autocompletionexample/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Generated by Django 2.1.11 on 2019-08-06 20:44

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='Bar',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='The bar name', max_length=50)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='Egg',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='The egg name', max_length=50)),
('name2', models.CharField(help_text='The egg 2nd name', max_length=50)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='ExtraSpam',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='The extra spam name', max_length=50)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='Foo',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='The foo name', max_length=50)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='FooExtraSpam',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('extra_spam', models.ForeignKey(help_text='The extra spam object', on_delete=django.db.models.deletion.CASCADE, to='autocompletionexample.ExtraSpam')),
('foo', models.ForeignKey(help_text='The foo object', on_delete=django.db.models.deletion.CASCADE, to='autocompletionexample.Foo')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='Spam',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='The spam name', max_length=50)),
('foo', models.ManyToManyField(to='autocompletionexample.Foo')),
],
options={
'abstract': False,
},
),
migrations.AddField(
model_name='extraspam',
name='foo',
field=models.ManyToManyField(through='autocompletionexample.FooExtraSpam', to='autocompletionexample.Foo'),
),
migrations.AddField(
model_name='egg',
name='foo',
field=models.OneToOneField(help_text='The foo object', on_delete=django.db.models.deletion.CASCADE, to='autocompletionexample.Foo'),
),
migrations.AddField(
model_name='bar',
name='foo',
field=models.ForeignKey(help_text='The foo object', on_delete=django.db.models.deletion.CASCADE, to='autocompletionexample.Foo'),
),
]
Empty file.
Binary file modified example/database.sqlite3
Binary file not shown.
154 changes: 154 additions & 0 deletions example/demo/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# Generated by Django 2.1.11 on 2019-08-06 20:49

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='DoubleName',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name_a', models.CharField(max_length=50)),
('name_b', models.CharField(max_length=50)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='ErrorName',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='Impossible to save name', max_length=50)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='ForeignKeyToSimpleName',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=50)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='InlineModel',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=50)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='ManyToManyThrough',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=50)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='ManyToManyToDoubleName',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=50)),
('double_names', models.ManyToManyField(help_text='Double names help', to='demo.DoubleName', verbose_name='Verbose double names')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='ManyToManyToError',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=50)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='ManyToManyToSimpleName',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=50)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='SimpleName',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='Help text of the name', max_length=50)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='ThroughModel',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=50)),
('many_to_many_through', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='demo.ManyToManyThrough')),
('simple_name', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='demo.SimpleName')),
],
options={
'abstract': False,
},
),
migrations.AddField(
model_name='manytomanytosimplename',
name='simple_names',
field=models.ManyToManyField(help_text='Missing items will be auto-created', to='demo.SimpleName', verbose_name='Verbose simple names'),
),
migrations.AddField(
model_name='manytomanytoerror',
name='simple_names',
field=models.ManyToManyField(help_text='Impossible to save', to='demo.SimpleName', verbose_name='Verbose simple names'),
),
migrations.AddField(
model_name='manytomanythrough',
name='simple_names',
field=models.ManyToManyField(through='demo.ThroughModel', to='demo.SimpleName'),
),
migrations.AddField(
model_name='inlinemodel',
name='double_names',
field=models.ManyToManyField(to='demo.ManyToManyToDoubleName'),
),
migrations.AddField(
model_name='inlinemodel',
name='simple_name',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='demo.SimpleName'),
),
migrations.AddField(
model_name='inlinemodel',
name='simple_names',
field=models.ManyToManyField(to='demo.ManyToManyToSimpleName'),
),
migrations.AddField(
model_name='foreignkeytosimplename',
name='simple_name',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='demo.SimpleName'),
),
]
Empty file.
Binary file added example/other_database.sqlite3
Binary file not shown.
2 changes: 1 addition & 1 deletion example/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% load staticfiles %}
{% load static %}

{% block content %}

Expand Down
13 changes: 4 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,16 @@ def run_tests(self):
},
extras_require={
'docs': [
'django<2.1',
'django>3.0',
'mock',
'sphinx>=1.7.2',
'sphinx>=3.0.0',
],
'tests': [
'django-utils2>=2.5.0',
'django-utils2>=2.8.0',
'pytest',
'pytest-cache',
'pytest-cov',
'pytest-django',
'pytest-flakes',
'pytest-pep8',
'pytest-flake8',
],
},
long_description=long_description,
Expand All @@ -79,7 +77,4 @@ def run_tests(self):
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
],
install_requires=[
'six',
]
)
2 changes: 1 addition & 1 deletion tags_input/__about__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__package_name__ = 'django-tags-input'
__version__ = '4.6.0'
__version__ = '5.0.0'
__author__ = 'Rick van Hattem'
__author_email__ = 'wolph@wol.ph'
__description__ = ' '.join('''
Expand Down
9 changes: 5 additions & 4 deletions tags_input/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import functools

from django.conf import settings
from django.db import models
from django.utils.functional import curry

from . import exceptions

Expand Down Expand Up @@ -57,17 +58,17 @@ def get_mapping(model_or_queryset):
'Every mapping should have a field or fields attribute. Mapping: '
'%r' % mapping)

mapping.setdefault('split_func', curry(
mapping.setdefault('split_func', functools.partial(
mapping.get('split_func', split_func),
mapping['fields'],
mapping['separator'],
))
mapping.setdefault('join_func', curry(
mapping.setdefault('join_func', functools.partial(
mapping.get('join_func', join_func),
mapping['fields'],
mapping['separator'],
))
mapping.setdefault('filter_func', curry(
mapping.setdefault('filter_func', functools.partial(
mapping.get('filter_func', filter_func),
mapping['fields'],
mapping['separator'],
Expand Down
6 changes: 2 additions & 4 deletions tags_input/widgets.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import six

from django.conf import settings
from django import forms
from django.template.loader import render_to_string
Expand Down Expand Up @@ -51,7 +49,7 @@ def render(self, name, value, attrs=None, choices=(), renderer=None):

ids = []
for v in value:
if isinstance(v, six.integer_types):
if isinstance(v, int):
ids.append(v)

values_map = OrderedDict(map(
Expand All @@ -64,7 +62,7 @@ def render(self, name, value, attrs=None, choices=(), renderer=None):

values = []
for v in value:
if isinstance(v, six.integer_types):
if isinstance(v, int):
values.append(values_map[v])
else:
values.append(v)
Expand Down

0 comments on commit 95ec1bc

Please sign in to comment.