From c6da2a80a2fa664782403e0a0c7c16ab34f0a04d Mon Sep 17 00:00:00 2001 From: philtuskha Date: Wed, 2 May 2018 11:39:13 -0400 Subject: [PATCH 1/6] adding support for django-1.11 --- sorter/templatetags/sorter_tags.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sorter/templatetags/sorter_tags.py b/sorter/templatetags/sorter_tags.py index 1b4e7bc..19b6642 100644 --- a/sorter/templatetags/sorter_tags.py +++ b/sorter/templatetags/sorter_tags.py @@ -145,7 +145,8 @@ def as_value(self, data, context): {'sort_fields': get_text_list(parts, _('and'))}) extra_context = dict(data, title=title, label=label, url=url, query=query) - return render_to_string(self.using(data), extra_context, context) + extra_context.update(context.flatten()) + return render_to_string(self.using(data), extra_context) def find_query(self, wanted, orderings, default): """ From 04352b267738b4f0753b598bcb5aaa94d1a6971f Mon Sep 17 00:00:00 2001 From: philtuskha Date: Wed, 2 May 2018 11:52:30 -0400 Subject: [PATCH 2/6] adding classifier --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 204cc97..9c83dfa 100644 --- a/setup.py +++ b/setup.py @@ -37,6 +37,7 @@ def find_version(*file_paths): "Development Status :: 4 - Beta", 'Environment :: Web Environment', 'Framework :: Django', + 'Framework :: Django :: 1.11', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', From ec8f92e5727a49f15bd74311633ef03b1325e959 Mon Sep 17 00:00:00 2001 From: philtuskha Date: Wed, 2 May 2018 11:59:16 -0400 Subject: [PATCH 3/6] adding 1.10 classifier --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 9c83dfa..df4acd2 100644 --- a/setup.py +++ b/setup.py @@ -37,6 +37,7 @@ def find_version(*file_paths): "Development Status :: 4 - Beta", 'Environment :: Web Environment', 'Framework :: Django', + 'Framework :: Django :: 1.10', 'Framework :: Django :: 1.11', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', From 80516cb5ff7b2c7c29fd3cdc9b7d9b93944b5aaf Mon Sep 17 00:00:00 2001 From: Dane Summers Date: Wed, 2 May 2018 12:35:26 -0400 Subject: [PATCH 4/6] Fixes test suite for Django 1.11 --- requirements/tests.txt | 4 ++-- sorter/test_settings.py | 16 +++++++++++++++- sorter/tests.py | 4 ---- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/requirements/tests.txt b/requirements/tests.txt index bb4c15a..eac0d5c 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -1,6 +1,6 @@ docutils -milkman +milkman==0.4.5 django-ttag>=2.3 django-discover-runner coverage -flake8 \ No newline at end of file +flake8 diff --git a/sorter/test_settings.py b/sorter/test_settings.py index ce316ea..2f3a9f8 100644 --- a/sorter/test_settings.py +++ b/sorter/test_settings.py @@ -15,6 +15,20 @@ 'sorter', ] -TEST_RUNNER = 'discover_runner.DiscoverRunner' +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': ( + "django.contrib.auth.context_processors.auth", + ), + 'builtins': [ + 'sorter.templatetags.sorter_tags', + 'sorter.tests', + ] + }, + }, +] SECRET_KEY = 'something-something' diff --git a/sorter/tests.py b/sorter/tests.py index 1c193c4..ce74fbb 100644 --- a/sorter/tests.py +++ b/sorter/tests.py @@ -1,4 +1,3 @@ -from django import template from django.contrib.auth.models import User from django.contrib.admin.models import LogEntry from django.http import HttpResponse @@ -13,9 +12,6 @@ register = Library() -template.add_to_builtins('sorter.templatetags.sorter_tags') -template.add_to_builtins('sorter.tests') - @register.filter def sorter_tests_pks(value): From b68390df3944f373d1b83ce63f93b81d9df350c9 Mon Sep 17 00:00:00 2001 From: philtuskha Date: Wed, 2 May 2018 14:55:46 -0400 Subject: [PATCH 5/6] getting tests to pass --- requirements/tests.txt | 2 +- setup.py | 1 + sorter/test_settings.py | 17 ++++++++++++++++- sorter/tests.py | 10 +++------- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/requirements/tests.txt b/requirements/tests.txt index bb4c15a..3ad2947 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -1,5 +1,5 @@ docutils -milkman +model_mommy django-ttag>=2.3 django-discover-runner coverage diff --git a/setup.py b/setup.py index df4acd2..fe03807 100644 --- a/setup.py +++ b/setup.py @@ -37,6 +37,7 @@ def find_version(*file_paths): "Development Status :: 4 - Beta", 'Environment :: Web Environment', 'Framework :: Django', + 'Framework :: Django :: 1.9', 'Framework :: Django :: 1.10', 'Framework :: Django :: 1.11', 'Intended Audience :: Developers', diff --git a/sorter/test_settings.py b/sorter/test_settings.py index ce316ea..2e888f0 100644 --- a/sorter/test_settings.py +++ b/sorter/test_settings.py @@ -15,6 +15,21 @@ 'sorter', ] -TEST_RUNNER = 'discover_runner.DiscoverRunner' +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.contrib.auth.context_processors.auth', + ], + 'builtins': [ + 'sorter.templatetags.sorter_tags', + 'sorter.tests' + ], + }, + }, +] SECRET_KEY = 'something-something' diff --git a/sorter/tests.py b/sorter/tests.py index 1c193c4..60b6b3a 100644 --- a/sorter/tests.py +++ b/sorter/tests.py @@ -6,17 +6,13 @@ from django.test import TestCase from django.test.client import RequestFactory -from milkman.dairy import milkman +from model_mommy import mommy from sorter.conf import settings from sorter.utils import cycle_pairs register = Library() -template.add_to_builtins('sorter.templatetags.sorter_tags') -template.add_to_builtins('sorter.tests') - - @register.filter def sorter_tests_pks(value): pk_list = [] @@ -44,7 +40,7 @@ def tearDown(self): settings.SORTER_ALLOWED_CRITERIA = self.old_sorter_allowed_criteria def create_entries(self, count, **kwargs): - entries = [milkman.deliver(LogEntry, **kwargs) for i in range(count)] + entries = [mommy.make(LogEntry, **kwargs) for i in range(count)] return LogEntry.objects.filter(pk__in=[entry.pk for entry in entries]) def create_response(self, request, template, context=None): @@ -118,7 +114,7 @@ def test_request_not_in_context(self): def test_multiple_sorting(self): - testuser = milkman.deliver(User) + testuser = mommy.make(User) testuser.set_password("letmein") testuser.save() From c795ea67b1ad7e55e30b0363cd5c36f3ecff8924 Mon Sep 17 00:00:00 2001 From: philtuskha Date: Wed, 2 May 2018 15:16:14 -0400 Subject: [PATCH 6/6] bumped version --- sorter/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorter/__init__.py b/sorter/__init__.py index 0988857..1878d2d 100644 --- a/sorter/__init__.py +++ b/sorter/__init__.py @@ -1 +1 @@ -__version__ = "0.2" +__version__ = "0.3-caktus"