From fc44cf323042167b01059ed9f8d3bdee7cc76423 Mon Sep 17 00:00:00 2001 From: Artur Barseghyan Date: Tue, 6 Sep 2016 22:28:34 +0200 Subject: [PATCH] prepare 0.6.8; fixed changing order of the formelement, formelemententry, formhandler and formhandlerentry models --- CHANGELOG.rst | 7 ++++ setup.py | 4 +-- src/fobi/__init__.py | 4 +-- src/fobi/base.py | 23 ++++++++++--- .../migrations/0004_auto_20160906_1513.py | 34 +++++++++++++++++++ 5 files changed, 63 insertions(+), 9 deletions(-) create mode 100644 src/fobi/migrations/0004_auto_20160906_1513.py diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f0a9b1e0..329a43c5 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -16,6 +16,13 @@ are used for versioning (schema follows below): - All backwards incompatible changes are mentioned in this document. +0.6.8 +----- +2016-09-06 + +- Fixed changing order of the `FormElement`, `FormElementEntry`, `FormHandler` + and `FormHandlerEntry` models. + 0.6.7 ----- 2016-08-30 diff --git a/setup.py b/setup.py index dda415f7..fe660754 100644 --- a/setup.py +++ b/setup.py @@ -69,7 +69,7 @@ for static_dir in static_dirs: for locale_dir in locale_dirs: locale_files += [os.path.join(locale_dir, f) for f in os.listdir(locale_dir)] -version = '0.6.7' +version = '0.6.8' install_requires = [ 'Pillow>=2.0.0', @@ -81,7 +81,7 @@ install_requires = [ 'easy-thumbnails>=1.4', 'vishap>=0.1.3,<2.0', 'Unidecode>=0.04.1', - 'django-nine>=0.1.6', + 'django-nine>=0.1.9', ] # There are also conditional PY3/PY2 requirements. Scroll down to see them. diff --git a/src/fobi/__init__.py b/src/fobi/__init__.py index f75aa55f..05fb8452 100644 --- a/src/fobi/__init__.py +++ b/src/fobi/__init__.py @@ -1,6 +1,6 @@ __title__ = 'django-fobi' -__version__ = '0.6.7' -__build__ = 0x000050 +__version__ = '0.6.8' +__build__ = 0x000051 __author__ = 'Artur Barseghyan ' __copyright__ = '2014-2016 Artur Barseghyan' __license__ = 'GPL 2.0/LGPL 2.1' diff --git a/src/fobi/base.py b/src/fobi/base.py index 71f66131..0df2f8f9 100644 --- a/src/fobi/base.py +++ b/src/fobi/base.py @@ -1869,11 +1869,14 @@ def assemble_form_field_widget_class(base_class, plugin): # *********************************** Generic ********************************* # ***************************************************************************** -def get_registered_plugins(registry, as_instances=False): +def get_registered_plugins(registry, as_instances=False, sort_items=True): """ Gets a list of registered plugins in a form if tuple (plugin name, plugin description). If not yet autodiscovered, autodiscovers them. + :param registry: + :param bool as_instances: + :param bool sort_items: :return list: """ ensure_autodiscover() @@ -1887,6 +1890,9 @@ def get_registered_plugins(registry, as_instances=False): plugin_name = safe_text(plugin.name) registered_plugins.append((uid, plugin_name)) + if sort_items: + registered_plugins.sort() + return registered_plugins def get_registered_plugins_grouped(registry, sort_items=True): @@ -1914,11 +1920,16 @@ def get_registered_plugins_grouped(registry, sort_items=True): return registered_plugins -def get_registered_plugin_uids(registry, flattern=True): - """ - Gets a list of registered plugin uids as a list . If not yet - autodiscovered, autodiscovers them. +def get_registered_plugin_uids(registry, flattern=True, sort_items=True): + """Get a list of registered plugin uids as a list . + If not yet auto-discovered, auto-discovers them. + + The `sort_items` is applied only if `flattern` is True. + + :param registry: + :param bool flattern: + :param bool sort_items: :return list: """ ensure_autodiscover() @@ -1927,6 +1938,8 @@ def get_registered_plugin_uids(registry, flattern=True): if flattern: registered_plugin_uids = list(registered_plugin_uids) + if sort_items: + registered_plugin_uids.sort() return registered_plugin_uids diff --git a/src/fobi/migrations/0004_auto_20160906_1513.py b/src/fobi/migrations/0004_auto_20160906_1513.py new file mode 100644 index 00000000..b908e541 --- /dev/null +++ b/src/fobi/migrations/0004_auto_20160906_1513.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('fobi', '0003_auto_20160517_1005'), + ] + + operations = [ + migrations.AlterField( + model_name='formelement', + name='plugin_uid', + field=models.CharField(verbose_name='Plugin UID', unique=True, max_length=255, editable=False, choices=[(b'boolean', b'Boolean'), (b'checkbox_select_multiple', b'Checkbox select multiple'), (b'content_image', b'Content image'), (b'content_text', b'Content text'), (b'content_video', b'Content video'), (b'date', b'Date'), (b'date_drop_down', b'Date drop down'), (b'datetime', b'DateTime'), (b'decimal', b'Decimal'), (b'dummy', b'Dummy'), (b'email', b'Email'), (b'file', b'File'), (b'float', b'Float'), (b'hidden', b'Hidden'), (b'honeypot', b'Honeypot'), (b'input', b'Input'), (b'integer', b'Integer'), (b'ip_address', b'IP address'), (b'null_boolean', b'Null boolean'), (b'password', b'Password'), (b'radio', b'Radio'), (b'regex', b'Regex'), (b'select', b'Select'), (b'select_model_object', b'Select model object'), (b'select_multiple', b'Select multiple'), (b'select_multiple_model_objects', b'Select multiple model objects'), (b'select_multiple_with_max', b'Select multiple with max'), (b'slug', b'Slug'), (b'text', b'Text'), (b'textarea', b'Textarea'), (b'time', b'Time'), (b'url', b'URL')]), + ), + migrations.AlterField( + model_name='formelemententry', + name='plugin_uid', + field=models.CharField(max_length=255, verbose_name='Plugin name', choices=[(b'boolean', b'Boolean'), (b'checkbox_select_multiple', b'Checkbox select multiple'), (b'content_image', b'Content image'), (b'content_text', b'Content text'), (b'content_video', b'Content video'), (b'date', b'Date'), (b'date_drop_down', b'Date drop down'), (b'datetime', b'DateTime'), (b'decimal', b'Decimal'), (b'dummy', b'Dummy'), (b'email', b'Email'), (b'file', b'File'), (b'float', b'Float'), (b'hidden', b'Hidden'), (b'honeypot', b'Honeypot'), (b'input', b'Input'), (b'integer', b'Integer'), (b'ip_address', b'IP address'), (b'null_boolean', b'Null boolean'), (b'password', b'Password'), (b'radio', b'Radio'), (b'regex', b'Regex'), (b'select', b'Select'), (b'select_model_object', b'Select model object'), (b'select_multiple', b'Select multiple'), (b'select_multiple_model_objects', b'Select multiple model objects'), (b'select_multiple_with_max', b'Select multiple with max'), (b'slug', b'Slug'), (b'text', b'Text'), (b'textarea', b'Textarea'), (b'time', b'Time'), (b'url', b'URL')]), + ), + migrations.AlterField( + model_name='formhandler', + name='plugin_uid', + field=models.CharField(verbose_name='Plugin UID', unique=True, max_length=255, editable=False, choices=[(b'db_store', b'DB store'), (b'http_repost', b'HTTP Repost'), (b'mail', b'Mail')]), + ), + migrations.AlterField( + model_name='formhandlerentry', + name='plugin_uid', + field=models.CharField(max_length=255, verbose_name='Plugin name', choices=[(b'db_store', b'DB store'), (b'http_repost', b'HTTP Repost'), (b'mail', b'Mail')]), + ), + ]