prepare 0.4.11; fixes in bootstrap3 theme (related to rendering of the radio button); fixes in db_store plugin export on >django17

This commit is contained in:
Artur Barseghyan 2014-12-29 00:38:05 +01:00
parent 7bc788eba1
commit 58b8d77ec4
9 changed files with 70 additions and 6 deletions

2
.gitignore vendored
View file

@ -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

View file

@ -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

View file

@ -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.

View file

@ -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

View file

@ -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',
}

View file

@ -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',

View file

@ -1,6 +1,6 @@
__title__ = 'django-fobi'
__version__ = '0.4.10'
__build__ = 0x000019
__version__ = '0.4.11'
__build__ = 0x00001a
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
__copyright__ = 'Copyright (c) 2014 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'

View file

@ -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'

View file

@ -27,7 +27,20 @@
</label>
<div class="{% block form_element_field_wrapper_html_class %}{% endblock %}">
{{ 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 %}
<div class="radio">
<label>
<input type="radio" name="{{ field.html_name }}" value="{{ choice_value }}"{% if field.value == choice_value %}checked{% endif %}>
{{ choice_label }}
</label>
</div>
{% endfor %}
{% else %}
{{ field }}
{% endif %}
{% if field.errors %}
<span class="{% block form_element_error_html_class %}help-block has-error{% endblock %}">
@ -41,6 +54,7 @@
<span class="{% block form_element_help_text_html_class %}help-block{% endblock %}">{{ field.help_text|safe }}</span>
{% endif %}
</div>
</div>
{% endif %}