prepare 0.11.9

This commit is contained in:
Artur Barseghyan 2017-05-24 00:12:11 +02:00
parent 49dc400743
commit db7bb9376f
13 changed files with 213 additions and 83 deletions

1
.gitignore vendored
View file

@ -14,6 +14,7 @@ ghostdriver.log
*.py,cover
/.idea/
codebin.py
examples/mezzanine_example/dev.db
MANIFEST.in~
MIND_BUCKET.rst

View file

@ -15,6 +15,14 @@ are used for versioning (schema follows below):
0.3.4 to 0.4).
- All backwards incompatible changes are mentioned in this document.
0.11.9
------
2017-05-24
- Mezzanine integration updated to work with Mezzanine 4.2.3.
- Fixes in date-drop-down plugin when using form wizards.
0.11.8
------
2017-05-17

View file

@ -47,9 +47,15 @@ Regarding the form wizards
- Add selenium tests for form wizards.
- Make `foundation5` and `django-admin-theme` themes to reflect the latest
GUI changes (form wizards).
+ Fix bug with wizards https://django-fobi.herokuapp.com/en/fobi/wizard-view/test-wiz/
When having a date-drop-down plugin on a page, on submit you get
TypeError at /en/fobi/wizard-view/test-wiz/
datetime.date(2001, 1, 1) is not JSON serializable
Surprisingly, with date or datetime plugins we don't get such errors.
In a normal form view, also not. It's something specific to form-wizards.
Regarding the djangorestframework integration
---------------------------------------------
Regarding the Django REST framework integration
-----------------------------------------------
+ Submit form functionality.
+ Advanced plugins, such as file plugin.
- Add image plugin.
@ -57,7 +63,7 @@ Regarding the djangorestframework integration
- Advanced foreign key relation plugins (MPTT).
- Think of handling the wizards.
Regarding heroku demo
Regarding Heroku demo
---------------------
- See if we can use `django-storages
<https://github.com/jschneier/django-storages>`_ for saving the files,
@ -74,7 +80,7 @@ Roadmap
Uncategorised
-------------
- Update translations.
- Update Mezzanine, DjangoCMS and FeinCMS integation to work with Django 1.8,
- Update Mezzanine, DjangoCMS and FeinCMS integration to work with Django 1.8,
1.9, 1.10 and 1.11.
- Implement a set of django-treebeard plugins (as an alternative to MPTT).
- Implement external image plugin.

View file

@ -1,5 +1,5 @@
=====================================
===========================================================
Example project for fobi.contrib.apps.mezzanine_integration
=====================================
===========================================================
Mezzanine integration example project for
``fobi.contrib.apps.mezzanine_integration``.

View file

@ -1 +1,2 @@
Mezzanine==3.1.10
Mezzanine==4.2.3
https://github.com/stephenmcd/filebrowser-safe/archive/v0.4.6.zip

View file

@ -1,4 +1,21 @@
from __future__ import absolute_import, unicode_literals
import os
from nine.versions import (
DJANGO_GTE_1_10,
DJANGO_GTE_1_7,
DJANGO_GTE_1_8,
DJANGO_GTE_1_9,
DJANGO_LTE_1_7,
)
# Full filesystem path to the project.
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
# Name of the directory for the project.
PROJECT_DIRNAME = PROJECT_ROOT.split(os.sep)[-1]
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
gettext = lambda s: s
@ -139,12 +156,117 @@ USE_I18N = False
# * Receive x-headers
INTERNAL_IPS = ("127.0.0.1",)
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
'django.template.loaders.eggs.Loader',
)
try:
from .local_settings import DEBUG_TEMPLATE
except Exception as err:
DEBUG_TEMPLATE = False
########################################################
if DJANGO_GTE_1_10:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
# 'APP_DIRS': True,
'DIRS': [os.path.join(PROJECT_ROOT, "templates")],
'OPTIONS': {
'context_processors': [
"django.template.context_processors.debug",
'django.template.context_processors.request',
"django.contrib.auth.context_processors.auth",
# "django.template.context_processors.i18n",
# "django.template.context_processors.media",
# "django.template.context_processors.static",
"django.template.context_processors.tz",
"django.contrib.messages.context_processors.messages",
"mezzanine.conf.context_processors.settings",
"mezzanine.pages.context_processors.page",
"fobi.context_processors.theme", # Important!
"fobi.context_processors.dynamic_values", # Optional
# "context_processors.testing", # Testing
],
'loaders': [
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
'django.template.loaders.eggs.Loader',
],
'debug': DEBUG_TEMPLATE,
}
},
]
elif DJANGO_GTE_1_8:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
# 'APP_DIRS': True,
'DIRS': [os.path.join(PROJECT_ROOT, "templates")],
'OPTIONS': {
'context_processors': [
"django.contrib.auth.context_processors.auth",
"django.template.context_processors.debug",
"django.template.context_processors.i18n",
"django.template.context_processors.media",
"django.template.context_processors.static",
"django.template.context_processors.tz",
"django.contrib.messages.context_processors.messages",
"django.template.context_processors.request",
"mezzanine.conf.context_processors.settings",
"mezzanine.pages.context_processors.page",
"fobi.context_processors.theme", # Important!
"fobi.context_processors.dynamic_values", # Optional
# "context_processors.testing", # Testing
],
'loaders': [
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
'django.template.loaders.eggs.Loader',
],
'debug': DEBUG_TEMPLATE,
}
},
]
else:
TEMPLATE_DEBUG = DEBUG_TEMPLATE
# List of callables that know how to import templates from various
# sources.
TEMPLATE_LOADERS = [
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
'django.template.loaders.eggs.Loader',
]
if DJANGO_GTE_1_7:
TEMPLATE_LOADERS.append('admin_tools.template_loaders.Loader')
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages",
"django.core.context_processors.request",
"fobi.context_processors.theme", # Important!
"fobi.context_processors.dynamic_values", # Optional
# "context_processors.testing", # Testing
"mezzanine.conf.context_processors.settings",
"mezzanine.pages.context_processors.page",
)
TEMPLATE_DIRS = (
os.path.join(PROJECT_ROOT, "templates"),
)
########################################################
AUTHENTICATION_BACKENDS = ("mezzanine.core.auth_backends.MezzanineBackend",)
@ -153,7 +275,7 @@ AUTHENTICATION_BACKENDS = ("mezzanine.core.auth_backends.MezzanineBackend",)
STATICFILES_FINDERS = (
"django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
# The numeric mode to set newly-uploaded files to. The value should be
@ -187,14 +309,6 @@ DATABASES = {
# PATHS #
#########
import os
# Full filesystem path to the project.
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
# Name of the directory for the project.
PROJECT_DIRNAME = PROJECT_ROOT.split(os.sep)[-1]
# Every cache key will get prefixed with this value - here we set it to
# the name of the directory the project is in to try and use something
# project specific.
@ -222,13 +336,6 @@ MEDIA_ROOT = os.path.join(PROJECT_ROOT, *MEDIA_URL.strip("/").split("/"))
# Package/module name to import the root urlpatterns from for the project.
ROOT_URLCONF = "%s.urls" % PROJECT_DIRNAME
# Put strings here, like "/home/html/django_templates"
# or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
TEMPLATE_DIRS = (os.path.join(PROJECT_ROOT, "templates"),)
################
# APPLICATIONS #
################
@ -251,15 +358,13 @@ INSTALLED_APPS = (
"mezzanine.pages",
"mezzanine.galleries",
"mezzanine.twitter",
#"mezzanine.accounts",
#"mezzanine.mobile",
# "mezzanine.accounts",
# "mezzanine.mobile",
# Third party apps used in the project
'south', # Database migration app
#'tinymce', # TinyMCE
'easy_thumbnails', # Thumbnailer
#'registration', # Auth views and registration app
#'localeurl', # Locale URL
'tinymce', # TinyMCE
'easy_thumbnails', # Thumbnailer
# 'registration', # Auth views and registration app
# ***********************************************************************
# ***********************************************************************
@ -277,18 +382,18 @@ INSTALLED_APPS = (
# ***********************************************************************
# ************************ Bootstrap 3 theme ****************************
# ***********************************************************************
'fobi.contrib.themes.bootstrap3', # Bootstrap 3 theme
'fobi.contrib.themes.bootstrap3', # Bootstrap 3 theme
# ***********************************************************************
# ************************ Foundation 5 theme ***************************
# ***********************************************************************
'fobi.contrib.themes.foundation5', # Foundation 5 theme
'fobi.contrib.themes.foundation5', # Foundation 5 theme
'fobi.contrib.themes.foundation5.widgets.form_handlers.db_store_foundation5_widget',
# ***********************************************************************
# **************************** Simple theme *****************************
# ***********************************************************************
'fobi.contrib.themes.simple', # Simple theme
'fobi.contrib.themes.simple', # Simple theme
# ***********************************************************************
# ***********************************************************************
@ -314,7 +419,7 @@ INSTALLED_APPS = (
'fobi.contrib.plugins.form_elements.fields.select',
'fobi.contrib.plugins.form_elements.fields.select_model_object',
'fobi.contrib.plugins.form_elements.fields.select_multiple',
#'fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects',
# 'fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects',
'fobi.contrib.plugins.form_elements.fields.text',
'fobi.contrib.plugins.form_elements.fields.textarea',
'fobi.contrib.plugins.form_elements.fields.url',
@ -360,24 +465,6 @@ INSTALLED_APPS = (
'foo',
)
# List of processors used by RequestContext to populate the context.
# Each one should be a callable that takes the request object as its
# only parameter and returns a dictionary to add to the context.
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.static",
"django.core.context_processors.media",
"django.core.context_processors.request",
"django.core.context_processors.tz",
"mezzanine.conf.context_processors.settings",
"mezzanine.pages.context_processors.page",
"fobi.context_processors.theme", # Important!
)
# List of middleware classes to use. Order is important; in the request phase,
# these middleware classes will be applied in the order given, and in the
# response phase the middleware will be applied in reverse order.
@ -466,9 +553,9 @@ OPTIONAL_APPS = (
# defined per machine.
try:
from local_settings import *
except ImportError as e:
if "local_settings" not in str(e):
raise e
except ImportError as err:
if "local_settings" not in str(err):
raise err
####################

View file

@ -1,4 +1,4 @@
from settings import *
from .settings import *
# Fobi extra configuration
FOBI_DEFAULT_THEME = 'bootstrap3'

View file

@ -25,7 +25,7 @@ fobi_theme_home_template_mapping = {
fobi_home_template = fobi_theme_home_template_mapping.get(
DEFAULT_THEME,
'home/base.html'
)
)
FOBI_EDIT_URLS_PREFIX = ''
if 'simple' == DEFAULT_THEME:
@ -40,32 +40,31 @@ admin.autodiscover()
# Add the urlpatterns for any custom Django applications here.
# You can also change the ``home`` view to add your own functionality
# to the project's homepage.
urlpatterns = []
urlpatterns = i18n_patterns([
# Change the admin prefix here to use an alternate URL for the
# admin interface, which would be marginally more secure.
("^admin/", include(admin.site.urls)),
])
# urlpatterns += i18n_patterns([
# # Change the admin prefix here to use an alternate URL for the
# # admin interface, which would be marginally more secure.
# url("^admin/", include(admin.site.urls)),
# ])
# ***********
# Fobi patterns
# ***********
urlpatterns += [
url("^admin/", include(admin.site.urls)),
# DB Store plugin URLs
url(r'^fobi/plugins/form-handlers/db-store/',
include('fobi.contrib.plugins.form_handlers.db_store.urls')),
#, namespace='fobi'
# django-fobi URLs:
url(r'^fobi/', include('fobi.urls.view')), #, namespace='fobi'
url(r'^fobi/', include('fobi.urls.view')),
url(r'^{0}fobi/'.format(FOBI_EDIT_URLS_PREFIX), include('fobi.urls.edit')),
#, namespace='fobi'
url(r'^fobi-home/$', TemplateView.as_view(template_name=fobi_home_template)),
# django-fobi public forms contrib app:
#url(r'^', include('fobi.contrib.apps.public_forms.urls')),
url(r'^fobi-home/$',
TemplateView.as_view(template_name=fobi_home_template)),
]
# ***********

View file

@ -1,8 +1,11 @@
# Django settings for example project.
import os
from nine.versions import (
DJANGO_GTE_1_7, DJANGO_GTE_1_8, DJANGO_LTE_1_7, DJANGO_GTE_1_9,
DJANGO_GTE_1_10
DJANGO_GTE_1_10,
DJANGO_GTE_1_7,
DJANGO_GTE_1_8,
DJANGO_GTE_1_9,
DJANGO_LTE_1_7,
)

View file

@ -4,7 +4,7 @@ import sys
from distutils.version import LooseVersion
from setuptools import setup, find_packages
version = '0.11.8'
version = '0.11.9'
# ***************************************************************************
# ************************** Python version *********************************

View file

@ -1,6 +1,6 @@
__title__ = 'django-fobi'
__version__ = '0.11.8'
__build__ = 0x000083
__version__ = '0.11.9'
__build__ = 0x000084
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
__copyright__ = '2014-2017 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'

View file

@ -1,13 +1,14 @@
from six import python_2_unicode_compatible
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ugettext, ugettext_lazy as _
from mezzanine.core.models import RichText
from mezzanine.pages.models import Page
from .helpers import (
get_form_template_choices, get_success_page_template_choices
get_form_template_choices,
get_success_page_template_choices,
)
__title__ = 'fobi.contrib.apps.mezzanine_integration.models'
@ -78,4 +79,4 @@ class FobiFormPage(Page, RichText):
# db_table = 'fobi_fobiformpage'
def __str__(self):
return _('Fobi form')
return ugettext('Fobi form')

View file

@ -52,3 +52,27 @@ class DateDropDownInputPlugin(FormFieldPlugin):
# kwargs['input_formats'] = self.data.input_formats
return [(self.data.name, DateField, field_kwargs)]
def submit_plugin_form_data(self, form_entry, request, form,
form_element_entries=None, **kwargs):
"""Submit plugin form data/process.
:param fobi.models.FormEntry form_entry: Instance of
``fobi.models.FormEntry``.
:param django.http.HttpRequest request:
:param django.forms.Form form:
"""
# In case if we should submit value as is, we don't return anything.
# In other cases, we proceed further.
# Get the object
value = form.cleaned_data.get(self.data.name, None)
try:
value = value.strftime("%Y-%m-%d")
except Exception as err:
pass
# Overwrite ``cleaned_data`` of the ``form`` with object qualifier.
form.cleaned_data[self.data.name] = value
return form