diff --git a/.gitignore b/.gitignore index d5ec7707..c1a2aeea 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,5 @@ fobi/fobi.migrations.rst /examples/simple/local_settings.py /examples/simple/local_settings_foundation5.py /src/fobi/contrib/plugins/form_importers/mailchimp_importer/ +/src/fobi/nine.py + diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b76a1fe3..9dcc530a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -15,6 +15,13 @@ are used for versioning (schema follows below): 0.3.4 to 0.4). - All backwards incompatible changes are mentioned in this document. +0.4.11 +------------------------------------- +2012-12-29 + +- Styling fixes in the ``radio`` button field of the ``bootstrap3`` theme. +- Fixed ``db_store`` issue with CSV/XLS export failing on Django 1.7. + 0.4.10 ------------------------------------- 2012-12-28 diff --git a/TODOS.rst b/TODOS.rst index 75b82cba..251a6912 100644 --- a/TODOS.rst +++ b/TODOS.rst @@ -194,6 +194,8 @@ Must haves CSV export. + Make appropriate additions to the documentation reflecting the changes made in 0.3.5 (or 0.4). +- Fix the CSV/XLS export in ``db_store`` for Django 1.7. +- Nicer styling for the radio button. - Make sure, that theme specific theme javascripts, css and other assets, are defined in the theme itself. Follow the ``django-dash`` example as much as possible. diff --git a/examples/simple/runserver-bootstrap3-theme-django17-feincms_integration.sh b/examples/simple/runserver-bootstrap3-theme-django17-feincms_integration.sh new file mode 100755 index 00000000..7bb6cfbf --- /dev/null +++ b/examples/simple/runserver-bootstrap3-theme-django17-feincms_integration.sh @@ -0,0 +1,2 @@ +#workon fobi +./manage.py runserver 0.0.0.0:8000 --traceback -v 3 --settings=settings_bootstrap3_theme_django17_feincms --traceback -v 3 diff --git a/examples/simple/settings_bootstrap3_theme_django17_feincms.py b/examples/simple/settings_bootstrap3_theme_django17_feincms.py new file mode 100644 index 00000000..7943ab69 --- /dev/null +++ b/examples/simple/settings_bootstrap3_theme_django17_feincms.py @@ -0,0 +1,23 @@ +from settings import * + +INSTALLED_APPS = list(INSTALLED_APPS) + +try: + INSTALLED_APPS.remove('south') if 'south' in INSTALLED_APPS else None + #INSTALLED_APPS.remove('tinymce') if 'tinymce' in INSTALLED_APPS else None + INSTALLED_APPS.remove('admin_tools.dashboard') if 'admin_tools.dashboard' in INSTALLED_APPS else None + + INSTALLED_APPS += [ + 'feincms', # FeinCMS + + 'fobi.contrib.apps.feincms_integration', # Fobi FeinCMS app + + 'page', # Example + ] +except Exception as e: + pass + + +FEINCMS_RICHTEXT_INIT_CONTEXT = { + 'TINYMCE_JS_URL': STATIC_URL + 'tiny_mce/tiny_mce.js', +} diff --git a/setup.py b/setup.py index f6595496..296b7420 100644 --- a/setup.py +++ b/setup.py @@ -58,7 +58,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.4.10' +version = '0.4.11' install_requires = [ 'Pillow>=2.0.0', diff --git a/src/fobi/__init__.py b/src/fobi/__init__.py index 27c63d8f..39b0f696 100644 --- a/src/fobi/__init__.py +++ b/src/fobi/__init__.py @@ -1,6 +1,6 @@ __title__ = 'django-fobi' -__version__ = '0.4.10' -__build__ = 0x000019 +__version__ = '0.4.11' +__build__ = 0x00001a __author__ = 'Artur Barseghyan ' __copyright__ = 'Copyright (c) 2014 Artur Barseghyan' __license__ = 'GPL 2.0/LGPL 2.1' diff --git a/src/fobi/contrib/plugins/form_handlers/db_store/helpers.py b/src/fobi/contrib/plugins/form_handlers/db_store/helpers.py index 00b94e83..d1bb518a 100644 --- a/src/fobi/contrib/plugins/form_handlers/db_store/helpers.py +++ b/src/fobi/contrib/plugins/form_handlers/db_store/helpers.py @@ -16,6 +16,7 @@ import json from six import StringIO, BytesIO +from django import VERSION as DJANGO_VERSION from django.http import HttpResponse from fobi.exceptions import ImproperlyConfigured @@ -31,6 +32,17 @@ class DataExporter(object): def __init__(self, queryset): self.queryset = queryset + def _get_initial_response(self, mimetype="application/csv"): + """ + For compatibility with older versions (`mimetype` vs `content_type`). + """ + response_kwargs = {} + if DJANGO_VERSION[0] >= 1 and DJANGO_VERSION[1] >= 7: + response_kwargs['content_type'] = mimetype + else: + response_kwargs['mimetype'] = mimetype + return HttpResponse(**response_kwargs) + def _get_data_headers(self): """ Since we have to deal with non-structured form data, we want to make @@ -67,7 +79,8 @@ class DataExporter(object): # 'align: wrap on, vert top, horiz left;', num_format_str='general' # ) - response = HttpResponse(mimetype="application/csv") + #response = HttpResponse(mimetype="application/csv") + response = self._get_initial_response(mimetype="application/csv") response['Content-Disposition'] = \ 'attachment; filename=db_store_export_data.xls' wb = xlwt.Workbook(encoding="UTF-8") @@ -113,7 +126,8 @@ class DataExporter(object): """ Export data to CSV. """ - response = HttpResponse(mimetype="text/csv") + #response = HttpResponse(mimetype="text/csv") + response = self._get_initial_response(mimetype="text/csv") response['Content-Disposition'] = \ 'attachment; filename=db_store_export_data.csv' diff --git a/src/fobi/templates/fobi/generic/snippets/form_snippet.html b/src/fobi/templates/fobi/generic/snippets/form_snippet.html index 501b62b2..9a4b25c6 100644 --- a/src/fobi/templates/fobi/generic/snippets/form_snippet.html +++ b/src/fobi/templates/fobi/generic/snippets/form_snippet.html @@ -27,7 +27,20 @@
- {{ field }} + {% get_form_field_type field as form_field_type %} + + {% if form_field_type.is_radio %} + {% for choice_value, choice_label in field.field.choices %} +
+ +
+ {% endfor %} + {% else %} + {{ field }} + {% endif %} {% if field.errors %} @@ -41,6 +54,7 @@ {{ field.help_text|safe }} {% endif %}
+ {% endif %}