mirror of
https://github.com/Hopiu/django-fobi.git
synced 2026-03-16 22:10:28 +00:00
prepare 0.8.5; add range_select plugin; add slider plugin and corresponding bootstrap3 widget; fixes in readme; fixed issue with form-wizard file storage; fixed too much of extreme data view- and export- restrictions of the db_store form handler plugin; minor fixes in select_multiple_with_max plugin; migration fixes for django 1.8 and 1.9
This commit is contained in:
parent
7d8cced9a4
commit
e8d0bc306c
114 changed files with 3725 additions and 328 deletions
|
|
@ -15,6 +15,19 @@ are used for versioning (schema follows below):
|
|||
0.3.4 to 0.4).
|
||||
- All backwards incompatible changes are mentioned in this document.
|
||||
|
||||
0.8.5
|
||||
-----
|
||||
2016-10-20
|
||||
|
||||
- Add `percentage` and `slider_percentage` form field plugins.
|
||||
- Fixed custom CSS classes not appearing in the rendered HTML of the field
|
||||
plugin/widget.
|
||||
- Fixed issue with undefined file storage for form wizards. From now on
|
||||
the `FileSystemStorage` storage is used for wizard uploads.
|
||||
- Fixed too much of extreme data view/export security of the `db_store`
|
||||
plugin.
|
||||
- Backwards compatibility fixes for Django < 1.7.
|
||||
|
||||
0.8.4
|
||||
-----
|
||||
2016-10-19
|
||||
|
|
|
|||
66
LICENSES.rst
66
LICENSES.rst
|
|
@ -1,10 +1,10 @@
|
|||
==============================
|
||||
========
|
||||
Licenses
|
||||
==============================
|
||||
========
|
||||
Below information about third-party packages used in the project is presented.
|
||||
|
||||
Bootstrap3
|
||||
==============================
|
||||
==========
|
||||
http://getbootstrap.com/
|
||||
|
||||
Licensing information:
|
||||
|
|
@ -12,21 +12,35 @@ Licensing information:
|
|||
- Apache license 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
||||
Bootstrap 3 DateTime picker
|
||||
==============================
|
||||
===========================
|
||||
http://eonasdan.github.io/bootstrap-datetimepicker/
|
||||
|
||||
- MIT (http://opensource.org/licenses/mit-license.html)
|
||||
|
||||
bootstrap-slider
|
||||
================
|
||||
https://github.com/seiyria/bootstrap-slider
|
||||
|
||||
- MIT (http://opensource.org/licenses/mit-license.html)
|
||||
|
||||
django-autoslug
|
||||
==============================
|
||||
===============
|
||||
https://bitbucket.org/neithere/django-autoslug
|
||||
|
||||
Licensing information:
|
||||
|
||||
- LGPL 3 (https://www.gnu.org/licenses/lgpl.html)
|
||||
|
||||
django-formtools
|
||||
================
|
||||
https://github.com/django/django-formtools
|
||||
|
||||
Licensing information:
|
||||
|
||||
- BSD (http://opensource.org/licenses/BSD-3-Clause)
|
||||
|
||||
django-nine
|
||||
==============================
|
||||
===========
|
||||
https://github.com/barseghyanartur/django-nine
|
||||
|
||||
Licensing information:
|
||||
|
|
@ -34,8 +48,17 @@ Licensing information:
|
|||
- GPL 2.0 (http://www.gnu.org/licenses/gpl-2.0.html)
|
||||
- LGPL 2.1 (https://www.gnu.org/licenses/lgpl-2.1.html)
|
||||
|
||||
django-nonefield
|
||||
================
|
||||
https://github.com/barseghyanartur/django-nonefield
|
||||
|
||||
Licensing information:
|
||||
|
||||
- GPL 2.0 (http://www.gnu.org/licenses/gpl-2.0.html)
|
||||
- LGPL 2.1 (https://www.gnu.org/licenses/lgpl-2.1.html)
|
||||
|
||||
easy-thumbnails
|
||||
==============================
|
||||
===============
|
||||
https://github.com/SmileyChris/easy-thumbnails
|
||||
|
||||
Licensing information:
|
||||
|
|
@ -43,7 +66,7 @@ Licensing information:
|
|||
- BSD (http://opensource.org/licenses/BSD-3-Clause)
|
||||
|
||||
Font-awesome
|
||||
==============================
|
||||
============
|
||||
http://fontawesome.io/
|
||||
|
||||
Licensing information:
|
||||
|
|
@ -53,7 +76,7 @@ Licensing information:
|
|||
- MIT (http://opensource.org/licenses/mit-license.html)
|
||||
|
||||
Foundation 5
|
||||
==============================
|
||||
============
|
||||
http://foundation.zurb.com/
|
||||
|
||||
Licensing information:
|
||||
|
|
@ -61,7 +84,7 @@ Licensing information:
|
|||
- MIT (http://opensource.org/licenses/mit-license.html)
|
||||
|
||||
Foundation 5 DateTime picker
|
||||
==============================
|
||||
============================
|
||||
https://github.com/aliibrahim/foundation-datetimepicker-rails
|
||||
|
||||
Licensing information:
|
||||
|
|
@ -69,7 +92,7 @@ Licensing information:
|
|||
- MIT (http://opensource.org/licenses/mit-license.html)
|
||||
|
||||
jQuery Colorbox
|
||||
==============================
|
||||
===============
|
||||
http://www.jacklmoore.com/colorbox/
|
||||
|
||||
Licensing information:
|
||||
|
|
@ -77,7 +100,7 @@ Licensing information:
|
|||
- MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
|
||||
jQuery
|
||||
==============================
|
||||
======
|
||||
https://jquery.org
|
||||
|
||||
Licensing information:
|
||||
|
|
@ -86,7 +109,7 @@ Licensing information:
|
|||
- MIT (http://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt)
|
||||
|
||||
jQueryUI
|
||||
==============================
|
||||
========
|
||||
http://jqueryui.com/
|
||||
|
||||
Licensing information:
|
||||
|
|
@ -94,7 +117,7 @@ Licensing information:
|
|||
- MIT (https://github.com/jquery/jquery-ui/blob/master/MIT-LICENSE.txt)
|
||||
|
||||
jQuery-Slugify-Plugin
|
||||
==============================
|
||||
=====================
|
||||
https://github.com/pmcelhaney/jQuery-Slugify-Plugin
|
||||
|
||||
Licensing information:
|
||||
|
|
@ -102,7 +125,7 @@ Licensing information:
|
|||
- BSD (https://github.com/pmcelhaney/jQuery-Slugify-Plugin/blob/master/LICENSE).
|
||||
|
||||
moment.js
|
||||
==============================
|
||||
=========
|
||||
http://momentjs.com/
|
||||
|
||||
Licensing information:
|
||||
|
|
@ -110,7 +133,7 @@ Licensing information:
|
|||
- MIT (http://opensource.org/licenses/mit-license.html)
|
||||
|
||||
ordereddict
|
||||
==============================
|
||||
===========
|
||||
https://pypi.python.org/pypi/ordereddict
|
||||
|
||||
Licensing information:
|
||||
|
|
@ -118,7 +141,7 @@ Licensing information:
|
|||
- MIT (http://opensource.org/licenses/mit-license.html)
|
||||
|
||||
Pillow
|
||||
==============================
|
||||
======
|
||||
http://python-pillow.github.io/
|
||||
|
||||
Licensing information:
|
||||
|
|
@ -126,7 +149,7 @@ Licensing information:
|
|||
- Python Imaging Library license (http://www.pythonware.com/products/pil/)
|
||||
|
||||
Requests
|
||||
==============================
|
||||
========
|
||||
https://python-requests.org
|
||||
|
||||
Licensing information:
|
||||
|
|
@ -134,7 +157,7 @@ Licensing information:
|
|||
- MIT (http://opensource.org/licenses/mit-license.html)
|
||||
|
||||
Six
|
||||
==============================
|
||||
===
|
||||
https://bitbucket.org/gutworth/six/
|
||||
|
||||
Licensing information:
|
||||
|
|
@ -142,7 +165,7 @@ Licensing information:
|
|||
- Apache 2.0 (http://opensource.org/licenses/Apache-2.0)
|
||||
|
||||
Unidecode
|
||||
==============================
|
||||
=========
|
||||
https://pypi.python.org/pypi/Unidecode
|
||||
|
||||
Licensing information:
|
||||
|
|
@ -150,11 +173,10 @@ Licensing information:
|
|||
- GPL 2.0 (http://www.gnu.org/licenses/gpl-2.0.html)
|
||||
|
||||
vishap
|
||||
==============================
|
||||
======
|
||||
https://pypi.python.org/pypi/vishap
|
||||
|
||||
Licensing information:
|
||||
|
||||
- GPL 2.0 (http://www.gnu.org/licenses/gpl-2.0.html)
|
||||
- LGPL 2.1 (https://www.gnu.org/licenses/lgpl-2.1.html)
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ recursive-include src/fobi/contrib/themes/bootstrap3/static *
|
|||
recursive-include src/fobi/contrib/themes/bootstrap3/widgets/form_elements/datetime_bootstrap3_widget/static *
|
||||
recursive-include src/fobi/contrib/themes/bootstrap3/widgets/form_elements/date_bootstrap3_widget/static *
|
||||
recursive-include src/fobi/contrib/themes/bootstrap3/widgets/form_elements/dummy_bootstrap3_widget/static *
|
||||
recursive-include src/fobi/contrib/themes/bootstrap3/widgets/form_elements/slider_bootstrap3_widget/static *
|
||||
recursive-include src/fobi/contrib/themes/foundation5/static *
|
||||
recursive-include src/fobi/contrib/themes/foundation5/widgets/form_elements/datetime_foundation5_widget/static *
|
||||
recursive-include src/fobi/contrib/themes/foundation5/widgets/form_elements/date_foundation5_widget/static *
|
||||
|
|
|
|||
34
README.rst
34
README.rst
|
|
@ -10,15 +10,9 @@ handling the submitted form data).
|
|||
|
||||
Prerequisites
|
||||
=============
|
||||
- Django 1.5, 1.6, 1.7, 1.8, 1.9
|
||||
- Django 1.5, 1.6, 1.7, 1.8, 1.9, 1.10
|
||||
- Python >= 2.6.8, >= 2.7, >= 3.3
|
||||
|
||||
Note, that Django 1.10 is not yet proclaimed to be flawlessly supported,
|
||||
however it's in progress. The latest core and contrib packages (from master
|
||||
branch, with no additional dependencies) have been tested against the latest
|
||||
stable Django 1.10 release. All tests have successfully passed, although it's
|
||||
yet too early to claim that Django 1.10 is fully supported.
|
||||
|
||||
Key concepts
|
||||
============
|
||||
- Each form consists of elements. Form elements are divided into two groups:
|
||||
|
|
@ -48,6 +42,9 @@ Main features and highlights
|
|||
- User-friendly GUI to quickly build forms.
|
||||
- Large variety of `Bundled form element plugins`_. Most of the Django fields
|
||||
are supported. `HTML5 fields`_ are supported as well.
|
||||
- `Form wizards`_. Combine your forms into wizards. Form wizards may contain
|
||||
handlers. Handler processes the form wizard data (for example, saves it or
|
||||
mails it). Number of the form wizard handlers is not limited.
|
||||
- Anti-spam solutions like `CAPTCHA
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/stable/src/fobi/contrib/plugins/form_elements/security/captcha>`_,
|
||||
`ReCAPTCHA
|
||||
|
|
@ -70,7 +67,6 @@ Main features and highlights
|
|||
and "DjangoCMS admin style" theme (which is another simple theme with editing
|
||||
interface in style of `djangocms-admin-style
|
||||
<https://github.com/divio/djangocms-admin-style>`_).
|
||||
- `Form wizards`_.
|
||||
- Implemented `integration with FeinCMS
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/stable/src/fobi/contrib/apps/feincms_integration>`_
|
||||
(in a form of a FeinCMS page widget).
|
||||
|
|
@ -454,7 +450,7 @@ Why to have another file for defining forms? Just to keep the code clean and
|
|||
less messy, although you could perfectly define all your plugin forms in the
|
||||
module `fobi_form_elements.py`, it's recommended to keep it separate.
|
||||
|
||||
Take into consideration, that `forms.py` is not an autodiscovered file pattern.
|
||||
Take into consideration, that `forms.py` is not an auto-discovered file pattern.
|
||||
All your form element plugins should be registered in modules named
|
||||
`fobi_form_elements.py`.
|
||||
|
||||
|
|
@ -678,7 +674,7 @@ Why to have another file for defining forms? Just to keep the code clean and
|
|||
less messy, although you could perfectly define all your plugin forms in the
|
||||
module `fobi_form_handlers.py`, it's recommended to keep it separate.
|
||||
|
||||
Take into consideration, that `forms.py` is not an autodiscovered file pattern.
|
||||
Take into consideration, that `forms.py` is not an auto-discovered file pattern.
|
||||
All your form handler plugins should be registered in modules named
|
||||
`fobi_form_handlers.py`.
|
||||
|
||||
|
|
@ -1570,7 +1566,7 @@ in directory of each plugin for details.
|
|||
|
||||
Fields
|
||||
~~~~~~
|
||||
Fields marked with asterics (*) fall under the definition of text elements.
|
||||
Fields marked with asterisk (*) fall under the definition of text elements.
|
||||
It's possible to provide `Dynamic initial values`_ for text elements.
|
||||
|
||||
- `Boolean (checkbox)
|
||||
|
|
@ -1591,10 +1587,6 @@ It's possible to provide `Dynamic initial values`_ for text elements.
|
|||
<https://github.com/barseghyanartur/django-fobi/tree/master/src/fobi/contrib/plugins/form_elements/fields/float>`_
|
||||
- `Hidden*
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/stable/src/fobi/contrib/plugins/form_elements/fields/hidden/>`_
|
||||
- `Password*
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/stable/src/fobi/contrib/plugins/form_elements/fields/password/>`_
|
||||
- `Radio select (radio button)
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/stable/src/fobi/contrib/plugins/form_elements/fields/radio/>`_
|
||||
- `Input
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/stable/src/fobi/contrib/plugins/form_elements/fields/input/>`_
|
||||
- `IP address*
|
||||
|
|
@ -1603,16 +1595,24 @@ It's possible to provide `Dynamic initial values`_ for text elements.
|
|||
<https://github.com/barseghyanartur/django-fobi/tree/stable/src/fobi/contrib/plugins/form_elements/fields/integer/>`_
|
||||
- `Null boolean
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/master/src/fobi/contrib/plugins/form_elements/fields/null_boolean>`_
|
||||
- `Password*
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/stable/src/fobi/contrib/plugins/form_elements/fields/password/>`_
|
||||
- `Radio select (radio button)
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/stable/src/fobi/contrib/plugins/form_elements/fields/radio/>`_
|
||||
- `Range select
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/stable/src/fobi/contrib/plugins/form_elements/fields/range_select/>`_
|
||||
- `Select (drop-down)
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/stable/src/fobi/contrib/plugins/form_elements/fields/select/>`_
|
||||
- `Select model object (drop-down)
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/stable/src/fobi/contrib/plugins/form_elements/fields/select_model_object/>`_
|
||||
- `Select multiple (drop-down)
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/stable/src/fobi/contrib/plugins/form_elements/fields/select_multiple/>`_
|
||||
- `Slug*
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/master/src/fobi/contrib/plugins/form_elements/fields/slug>`_
|
||||
- `Select multiple model objects (drop-down)
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/stable/src/fobi/contrib/plugins/form_elements/fields/select_multiple_model_objects/>`_
|
||||
- `Slider
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/master/src/fobi/contrib/plugins/form_elements/fields/slider>`_
|
||||
- `Slug*
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/master/src/fobi/contrib/plugins/form_elements/fields/slug>`_
|
||||
- `Text*
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/stable/src/fobi/contrib/plugins/form_elements/fields/text/>`_
|
||||
- `Textarea*
|
||||
|
|
|
|||
17
TODOS.rst
17
TODOS.rst
|
|
@ -22,16 +22,27 @@ Regarding the form wizards
|
|||
in case of private forms/wizards, they should be visible to author only,
|
||||
while being visible to everyone in case of public forms/wizards.
|
||||
+ Update `fobi_update_plugin_data` module with form-wizard.
|
||||
- Make sure to update the MANIFEST.in to include all additional templates.
|
||||
+ Make sure to update the MANIFEST.in to include all additional templates.
|
||||
+ Find a way to handle duplicates in saved form data in wizards (if labels
|
||||
are same within a couple of forms of the wizard).
|
||||
+ Add link/switch between forms and form wizards in the main template and
|
||||
separate listing templates.
|
||||
+ Make sure to include django-formtools package in the requirements.
|
||||
- Add navigation buttons to the form wizards.
|
||||
+ Add navigation buttons to the form wizards.
|
||||
- Rethink the new navigation of forms and form wizards.
|
||||
- Add support for form wizard conditions.
|
||||
|
||||
General
|
||||
Roadmap
|
||||
-------
|
||||
- django-rest-framework integration.
|
||||
- Reusable React app to communicate with django-rest-framework integration
|
||||
app.
|
||||
|
||||
Uncategorised
|
||||
-------------
|
||||
- Make sure form element plugin widgets allow more customisations than
|
||||
they do now. For instance, setting an additional class or additional data
|
||||
attributes should be made really easy. A must!
|
||||
+ Finish the NoneField.
|
||||
+ At the moment, NoneField is imported in the function scope. See if that works
|
||||
already to move
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ pickleshare==0.5
|
|||
Pillow==3.0.0
|
||||
pluggy==0.3.1
|
||||
ptyprocess==0.5
|
||||
py==1.4.30
|
||||
#py==1.4.31
|
||||
Pygments==2.0.2
|
||||
pytz==2015.6
|
||||
requests==2.8.1
|
||||
#requests==2.8.1
|
||||
selenium==2.53.6
|
||||
simplegeneric==0.8.1
|
||||
simplejson==3.8.0
|
||||
|
|
@ -33,7 +33,7 @@ Sphinx==1.3.1
|
|||
sphinx-rtd-theme==0.1.9
|
||||
sqlparse==0.1.17
|
||||
traitlets==4.0.0
|
||||
Unidecode==0.4.18
|
||||
#Unidecode==0.4.18
|
||||
virtualenv==13.1.2
|
||||
vishap==0.1.5
|
||||
#vishap>=0.1.5
|
||||
wheel==0.24.0
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
factory_boy==2.7.0
|
||||
fake-factory==0.7.2
|
||||
py==1.4.31
|
||||
pytest==3.0.2
|
||||
pytest-django==2.9.1
|
||||
pytest-cov==2.2.1
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
Django>=1.10,<1.11
|
||||
django-admin-tools>=0.8.0
|
||||
django-autoslug==1.9.3
|
||||
#django-autoslug==1.9.3
|
||||
django-debug-toolbar==1.5
|
||||
django-formtools==1.0
|
||||
django-nine>=0.1.10
|
||||
django-nonefield==0.1
|
||||
#django-formtools==1.0
|
||||
#django-nine>=0.1.10
|
||||
#django-nonefield==0.1
|
||||
django-registration-redux>=1.4
|
||||
easy-thumbnails==2.3
|
||||
vishap>=0.1.5
|
||||
#easy-thumbnails==2.3
|
||||
#vishap>=0.1.5
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
Django>=1.5,<1.6
|
||||
South>=0.8.2
|
||||
django-admin-tools==0.5.2
|
||||
django-autoslug>=1.7.1
|
||||
#django-autoslug>=1.7.1
|
||||
django-debug-toolbar>=0.11.0
|
||||
django-localeurl>=2.0.2
|
||||
django-nine>=0.1.10
|
||||
django-nonefield>=0.1
|
||||
django-registration-redux>=1.1
|
||||
easy-thumbnails==2.3
|
||||
vishap>=0.1.5
|
||||
#django-nine>=0.1.10
|
||||
#django-nonefield>=0.1
|
||||
django-registration-redux==1.2
|
||||
#easy-thumbnails==2.3
|
||||
#vishap>=0.1.5
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
Django>=1.6,<1.7
|
||||
South>=0.8.2
|
||||
django-admin-tools==0.5.2
|
||||
django-autoslug>=1.7.1
|
||||
#django-autoslug>=1.7.1
|
||||
django-debug-toolbar>=0.11.0
|
||||
django-localeurl>=2.0.2
|
||||
django-nine>=0.1.10
|
||||
django-nonefield>=0.1
|
||||
#django-nine>=0.1.10
|
||||
#django-nonefield>=0.1
|
||||
django-registration-redux==1.2
|
||||
easy-thumbnails==2.3
|
||||
vishap>=0.1.5
|
||||
#easy-thumbnails==2.3
|
||||
#vishap>=0.1.5
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
Django>=1.7,<1.8
|
||||
django-admin-tools>=0.6.0
|
||||
django-autoslug==1.7.1
|
||||
#django-autoslug==1.7.1
|
||||
django-debug-toolbar==0.11.0
|
||||
django-localeurl>=2.0.2
|
||||
django-nine>=0.1.10
|
||||
django-nonefield>=0.1
|
||||
#django-nine>=0.1.10
|
||||
#django-nonefield>=0.1
|
||||
django-registration-redux>=1.3
|
||||
easy-thumbnails==2.3
|
||||
vishap>=0.1.5
|
||||
#easy-thumbnails==2.3
|
||||
#vishap>=0.1.5
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
Django>=1.8,<1.9
|
||||
django-admin-tools>=0.6.0
|
||||
django-autoslug==1.7.1
|
||||
#django-autoslug==1.7.1
|
||||
django-debug-toolbar==0.11.0
|
||||
django-formtools
|
||||
#django-localeurl>=2.0.2
|
||||
django-nine>=0.1.10
|
||||
django-nonefield>=0.1
|
||||
#django-nine>=0.1.10
|
||||
#django-nonefield>=0.1
|
||||
django-registration-redux>=1.4
|
||||
easy-thumbnails==2.3
|
||||
vishap>=0.1.5
|
||||
#easy-thumbnails==2.3
|
||||
#vishap>=0.1.5
|
||||
|
|
|
|||
|
|
@ -9,9 +9,6 @@ mailchimp
|
|||
Sphinx
|
||||
django-admin-tools>=0.8.0
|
||||
django-debug-toolbar>=1.5
|
||||
django-formtools>=1.0
|
||||
#django-localeurl>=2.0.2
|
||||
django-nine>=0.1.9
|
||||
django-registration-redux>=1.4
|
||||
docutils
|
||||
ipdb
|
||||
|
|
@ -20,5 +17,3 @@ ordereddict>=1.1
|
|||
# Selenium shall always be upgraded
|
||||
selenium
|
||||
tox
|
||||
|
||||
#https://github.com/macropin/django-registration/archive/master.zip
|
||||
|
|
|
|||
1
examples/simple/runserver/bootstrap3-theme-django-1-5.sh
Executable file
1
examples/simple/runserver/bootstrap3-theme-django-1-5.sh
Executable file
|
|
@ -0,0 +1 @@
|
|||
./manage.py runserver 0.0.0.0:8000 --traceback -v 3 --settings=settings.bootstrap3_theme_django_1_5 --traceback -v 3
|
||||
1
examples/simple/runserver/bootstrap3-theme-django-1-6.sh
Executable file
1
examples/simple/runserver/bootstrap3-theme-django-1-6.sh
Executable file
|
|
@ -0,0 +1 @@
|
|||
./manage.py runserver 0.0.0.0:8000 --traceback -v 3 --settings=settings.bootstrap3_theme_django_1_6 --traceback -v 3
|
||||
|
|
@ -99,7 +99,7 @@ STATICFILES_DIRS = (
|
|||
STATICFILES_FINDERS = (
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
|
||||
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
|
||||
)
|
||||
|
||||
# Make this unique, and don't share it with anybody.
|
||||
|
|
@ -138,7 +138,7 @@ elif DJANGO_GTE_1_8:
|
|||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
#'APP_DIRS': True,
|
||||
# 'APP_DIRS': True,
|
||||
'DIRS': [PROJECT_DIR(os.path.join('..', 'templates')),],
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
|
|
@ -167,12 +167,14 @@ else:
|
|||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
# List of callables that know how to import templates from various sources.
|
||||
TEMPLATE_LOADERS = (
|
||||
TEMPLATE_LOADERS = [
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
'django.template.loaders.eggs.Loader',
|
||||
'admin_tools.template_loaders.Loader',
|
||||
)
|
||||
|
||||
]
|
||||
if DJANGO_GTE_1_7:
|
||||
TEMPLATE_LOADERS.append('admin_tools.template_loaders.Loader')
|
||||
|
||||
TEMPLATE_CONTEXT_PROCESSORS = (
|
||||
"django.contrib.auth.context_processors.auth",
|
||||
|
|
@ -196,7 +198,7 @@ else:
|
|||
|
||||
MIDDLEWARE_CLASSES = [
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'localeurl.middleware.LocaleURLMiddleware',
|
||||
# 'localeurl.middleware.LocaleURLMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
|
|
@ -205,17 +207,17 @@ MIDDLEWARE_CLASSES = [
|
|||
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
if DJANGO_GTE_1_8:
|
||||
MIDDLEWARE_CLASSES.remove('localeurl.middleware.LocaleURLMiddleware')
|
||||
# if DJANGO_GTE_1_8:
|
||||
# MIDDLEWARE_CLASSES.remove('localeurl.middleware.LocaleURLMiddleware')
|
||||
|
||||
ROOT_URLCONF = 'urls'
|
||||
|
||||
# Python dotted path to the WSGI application used by Django's runserver.
|
||||
WSGI_APPLICATION = 'wsgi.application'
|
||||
|
||||
#FIXTURE_DIRS = (
|
||||
# FIXTURE_DIRS = (
|
||||
# PROJECT_DIR(os.path.join('..', 'fixtures'))
|
||||
#)
|
||||
# )
|
||||
|
||||
INSTALLED_APPS = [
|
||||
# Admin dashboard
|
||||
|
|
@ -234,11 +236,11 @@ INSTALLED_APPS = [
|
|||
'django.contrib.sitemaps',
|
||||
|
||||
# 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
|
||||
# 'south', # Database migration app
|
||||
# 'tinymce', # TinyMCE
|
||||
'easy_thumbnails', # Thumbnailer
|
||||
'registration', # Auth views and registration app
|
||||
# 'localeurl', # Locale URL
|
||||
|
||||
# ***********************************************************************
|
||||
# ***********************************************************************
|
||||
|
|
@ -256,7 +258,7 @@ INSTALLED_APPS = [
|
|||
# ***********************************************************************
|
||||
# **************************** Form fields ******************************
|
||||
# ***********************************************************************
|
||||
#'fobi.contrib.plugins.form_elements.fields.birthday',
|
||||
# 'fobi.contrib.plugins.form_elements.fields.birthday',
|
||||
'fobi.contrib.plugins.form_elements.fields.boolean',
|
||||
'fobi.contrib.plugins.form_elements.fields.checkbox_select_multiple',
|
||||
'fobi.contrib.plugins.form_elements.fields.date',
|
||||
|
|
@ -267,19 +269,21 @@ INSTALLED_APPS = [
|
|||
'fobi.contrib.plugins.form_elements.fields.file',
|
||||
'fobi.contrib.plugins.form_elements.fields.float',
|
||||
'fobi.contrib.plugins.form_elements.fields.hidden',
|
||||
#'fobi.contrib.plugins.form_elements.fields.hidden_model_object',
|
||||
# 'fobi.contrib.plugins.form_elements.fields.hidden_model_object',
|
||||
'fobi.contrib.plugins.form_elements.fields.input',
|
||||
'fobi.contrib.plugins.form_elements.fields.integer',
|
||||
'fobi.contrib.plugins.form_elements.fields.ip_address',
|
||||
'fobi.contrib.plugins.form_elements.fields.null_boolean',
|
||||
'fobi.contrib.plugins.form_elements.fields.password',
|
||||
'fobi.contrib.plugins.form_elements.fields.radio',
|
||||
'fobi.contrib.plugins.form_elements.fields.range_select',
|
||||
'fobi.contrib.plugins.form_elements.fields.regex',
|
||||
'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_with_max',
|
||||
'fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects',
|
||||
'fobi.contrib.plugins.form_elements.fields.slider',
|
||||
'fobi.contrib.plugins.form_elements.fields.slug',
|
||||
'fobi.contrib.plugins.form_elements.fields.text',
|
||||
'fobi.contrib.plugins.form_elements.fields.textarea',
|
||||
|
|
@ -328,73 +332,76 @@ INSTALLED_APPS = [
|
|||
# ***********************************************************************
|
||||
# ************************ Bootstrap 3 theme ****************************
|
||||
# ***********************************************************************
|
||||
'fobi.contrib.themes.bootstrap3', # Bootstrap 3 theme
|
||||
'fobi.contrib.themes.bootstrap3', # Bootstrap 3 theme
|
||||
# DateTime widget
|
||||
'fobi.contrib.themes.bootstrap3.widgets.form_elements.datetime_bootstrap3_widget',
|
||||
'fobi.contrib.themes.bootstrap3.widgets.form_elements.date_bootstrap3_widget',
|
||||
|
||||
# SliderPercentage widget
|
||||
'fobi.contrib.themes.bootstrap3.widgets.form_elements.slider_bootstrap3_widget',
|
||||
|
||||
# ***********************************************************************
|
||||
# ************************ 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
|
||||
|
||||
# ***********************************************************************
|
||||
# ***********************************************************************
|
||||
# ************************* Fobi form importers *************************
|
||||
# ***********************************************************************
|
||||
# ***********************************************************************
|
||||
#'fobi.contrib.plugins.form_importers.mailchimp_importer',
|
||||
# 'fobi.contrib.plugins.form_importers.mailchimp_importer',
|
||||
|
||||
# ***********************************************************************
|
||||
# ***********************************************************************
|
||||
# ***********************************************************************
|
||||
|
||||
# Other project specific apps
|
||||
'foo', # Test app
|
||||
'foo', # Test app
|
||||
]
|
||||
|
||||
if DJANGO_LTE_1_7:
|
||||
INSTALLED_APPS.append('south')
|
||||
|
||||
if DJANGO_GTE_1_8:
|
||||
INSTALLED_APPS.remove('localeurl')
|
||||
# if DJANGO_GTE_1_8:
|
||||
# INSTALLED_APPS.remove('localeurl')
|
||||
|
||||
LOGIN_URL = '/accounts/login/'
|
||||
LOGIN_REDIRECT_URL = '/fobi/' # Important for passing the selenium tests
|
||||
# LOGIN_URL = '/accounts/login/'
|
||||
# LOGIN_REDIRECT_URL = '/fobi/' # Important for passing the selenium tests
|
||||
|
||||
if DJANGO_GTE_1_8:
|
||||
LOGIN_URL = '/en/accounts/login/'
|
||||
LOGIN_REDIRECT_URL = '/en/fobi/' # Important for passing the selenium tests
|
||||
# if DJANGO_GTE_1_8:
|
||||
LOGIN_URL = '/en/accounts/login/'
|
||||
LOGIN_REDIRECT_URL = '/en/fobi/' # Important for passing the selenium tests
|
||||
|
||||
#LOGIN_URL = '/accounts/login/'
|
||||
#LOGIN_ERROR_URL = '/accounts/login/'
|
||||
#LOGOUT_URL = '/accounts/logout/'
|
||||
|
||||
if not DJANGO_GTE_1_8:
|
||||
# Tell localeurl to use sessions for language store.
|
||||
LOCALEURL_USE_SESSION = True
|
||||
|
||||
# localeurl locale independent paths (language code won't be appended)
|
||||
LOCALE_INDEPENDENT_PATHS = (
|
||||
r'^/sitemap.*\.xml$', # Global regex for all XML sitemaps
|
||||
r'^/admin/',
|
||||
#r'^/dashboard/',
|
||||
)
|
||||
# if not DJANGO_GTE_1_8:
|
||||
# # Tell localeurl to use sessions for language store.
|
||||
# LOCALEURL_USE_SESSION = True
|
||||
#
|
||||
# # localeurl locale independent paths (language code won't be appended)
|
||||
# LOCALE_INDEPENDENT_PATHS = (
|
||||
# r'^/sitemap.*\.xml$', # Global regex for all XML sitemaps
|
||||
# r'^/admin/',
|
||||
# #r'^/dashboard/',
|
||||
# )
|
||||
|
||||
PACKAGE_NAME_FILEBROWSER = "filebrowser_safe" # Just for tests
|
||||
PACKAGE_NAME_GRAPPELLI = "grappelli_safe" # Just for tests
|
||||
|
||||
#MIGRATION_MODULES = {
|
||||
# 'fobi': 'migrations',
|
||||
# 'db_store': 'fobi.contrib.plugins.form_handlers.db_store.migrations'
|
||||
#}
|
||||
#SOUTH_MIGRATION_MODULES = 'south_migrations'
|
||||
MIGRATION_MODULES = {
|
||||
'fobi': 'migrations',
|
||||
'db_store': 'fobi.contrib.plugins.form_handlers.db_store.migrations'
|
||||
}
|
||||
SOUTH_MIGRATION_MODULES = 'south_migrations'
|
||||
|
||||
# **************************************************************
|
||||
# ************************ Fobi settings ***********************
|
||||
|
|
|
|||
9
examples/simple/settings/bootstrap3_theme_django_1_5.py
Normal file
9
examples/simple/settings/bootstrap3_theme_django_1_5.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
from .base import *
|
||||
|
||||
INSTALLED_APPS = list(INSTALLED_APPS)
|
||||
|
||||
try:
|
||||
INSTALLED_APPS.append('south') if 'south' not in INSTALLED_APPS else None
|
||||
# INSTALLED_APPS.remove('tinymce') if 'tinymce' in INSTALLED_APPS else None
|
||||
except Exception as e:
|
||||
pass
|
||||
9
examples/simple/settings/bootstrap3_theme_django_1_6.py
Normal file
9
examples/simple/settings/bootstrap3_theme_django_1_6.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
from .base import *
|
||||
|
||||
INSTALLED_APPS = list(INSTALLED_APPS)
|
||||
|
||||
try:
|
||||
INSTALLED_APPS.append('south') if 'south' not in INSTALLED_APPS else None
|
||||
# INSTALLED_APPS.remove('tinymce') if 'tinymce' in INSTALLED_APPS else None
|
||||
except Exception as e:
|
||||
pass
|
||||
|
|
@ -1 +1 @@
|
|||
from .bootstrap3_theme_django_1_9 import *
|
||||
from .base import *
|
||||
|
|
|
|||
147
setup.py
147
setup.py
|
|
@ -1,8 +1,65 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
from distutils.version import LooseVersion
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
# ****************************************************
|
||||
DJANGO_INSTALLED = False
|
||||
try:
|
||||
import django
|
||||
DJANGO_INSTALLED = True
|
||||
|
||||
LOOSE_DJANGO_VERSION = LooseVersion(django.get_version())
|
||||
LOOSE_DJANGO_MINOR_VERSION = LooseVersion(
|
||||
'.'.join([str(i) for i in LOOSE_DJANGO_VERSION.version[0:2]])
|
||||
)
|
||||
|
||||
# Loose versions
|
||||
LOOSE_VERSIONS = (
|
||||
'1.4', '1.5', '1.6', '1.7', '1.8', '1.9', '1.10', '1.11', '2.0', '2.1',
|
||||
'2.2', '3.0'
|
||||
)
|
||||
|
||||
for v in LOOSE_VERSIONS:
|
||||
var_name = 'LOOSE_VERSION_{0}'.format(v.replace('.', '_'))
|
||||
globals()[var_name] = LooseVersion(v)
|
||||
|
||||
# Exact versions
|
||||
EXACT_VERSIONS = LOOSE_VERSIONS[:-1]
|
||||
|
||||
for i, v in enumerate(EXACT_VERSIONS):
|
||||
l_cur = globals()['LOOSE_VERSION_{0}' \
|
||||
''.format(LOOSE_VERSIONS[i].replace('.', '_'))]
|
||||
l_nxt = globals()['LOOSE_VERSION_{0}' \
|
||||
''.format(LOOSE_VERSIONS[i + 1].replace('.', '_'))]
|
||||
var_name = 'DJANGO_{0}'.format(v.replace('.', '_'))
|
||||
globals()[var_name] = (l_cur <= LOOSE_DJANGO_VERSION < l_nxt)
|
||||
|
||||
# LTE list
|
||||
LTE_VERSIONS = LOOSE_VERSIONS[:-1]
|
||||
|
||||
for i, v in enumerate(EXACT_VERSIONS):
|
||||
l_cur = globals()['LOOSE_VERSION_{0}' \
|
||||
''.format(LOOSE_VERSIONS[i].replace('.', '_'))]
|
||||
var_name = 'DJANGO_LTE_{0}'.format(v.replace('.', '_'))
|
||||
globals()[var_name] = (LOOSE_DJANGO_MINOR_VERSION <= l_cur)
|
||||
|
||||
# GTE list
|
||||
GTE_VERSIONS = LOOSE_VERSIONS[:-1]
|
||||
|
||||
for i, v in enumerate(EXACT_VERSIONS):
|
||||
l_cur = globals()['LOOSE_VERSION_{0}' \
|
||||
''.format(LOOSE_VERSIONS[i].replace('.', '_'))]
|
||||
var_name = 'DJANGO_GTE_{0}'.format(v.replace('.', '_'))
|
||||
globals()[var_name] = (
|
||||
LOOSE_DJANGO_MINOR_VERSION >= l_cur
|
||||
)
|
||||
|
||||
except Exception as err:
|
||||
pass
|
||||
|
||||
# ****************************************************
|
||||
try:
|
||||
readme = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
|
||||
readme = readme.replace('.. code-block:: none', '.. code-block::')
|
||||
|
|
@ -89,6 +146,10 @@ static_dirs = [
|
|||
"src/fobi/contrib/themes/bootstrap3/widgets/form_elements/"
|
||||
"date_bootstrap3_widget/static",
|
||||
|
||||
# Bootstrap3 slider widget
|
||||
"src/fobi/contrib/themes/bootstrap3/widgets/form_elements/"
|
||||
"slider_bootstrap3_widget/static",
|
||||
|
||||
# Foundation5
|
||||
"src/fobi/contrib/themes/foundation5/static",
|
||||
|
||||
|
|
@ -138,20 +199,78 @@ for locale_dir in locale_dirs:
|
|||
for f
|
||||
in os.listdir(locale_dir)]
|
||||
|
||||
version = '0.8.4'
|
||||
version = '0.8.5'
|
||||
|
||||
install_requires = [
|
||||
'Pillow>=2.0.0',
|
||||
'requests>=1.0.0',
|
||||
'django-autoslug>=1.9.3',
|
||||
'django-nonefield>=0.1',
|
||||
'ordereddict>=1.1',
|
||||
'six>=1.9',
|
||||
'vishap>=0.1.3,<2.0',
|
||||
'Unidecode>=0.04.1',
|
||||
'django-nine>=0.1.9',
|
||||
'django-formtools>=1.0',
|
||||
]
|
||||
install_requires = []
|
||||
# If certain version of Django is already installed, choose version agnostic
|
||||
# dependencies.
|
||||
if DJANGO_INSTALLED:
|
||||
if DJANGO_1_5 or DJANGO_1_6 or DJANGO_1_7:
|
||||
install_requires = [
|
||||
'django-autoslug==1.7.1',
|
||||
# 'django-formtools>=1.0',
|
||||
'django-nine>=0.1.10',
|
||||
'django-nonefield>=0.1',
|
||||
'ordereddict>=1.1',
|
||||
'Pillow>=2.0.0',
|
||||
'requests>=1.0.0',
|
||||
'six>=1.9',
|
||||
'Unidecode>=0.04.1',
|
||||
'vishap>=0.1.5,<2.0',
|
||||
]
|
||||
elif DJANGO_1_8:
|
||||
install_requires = [
|
||||
'django-autoslug==1.7.1',
|
||||
'django-formtools>=1.0',
|
||||
'django-nine>=0.1.10',
|
||||
'django-nonefield>=0.1',
|
||||
'ordereddict>=1.1',
|
||||
'Pillow>=2.0.0',
|
||||
'requests>=1.0.0',
|
||||
'six>=1.9',
|
||||
'Unidecode>=0.04.1',
|
||||
'vishap>=0.1.5,<2.0',
|
||||
]
|
||||
elif DJANGO_1_9:
|
||||
install_requires = [
|
||||
'django-autoslug==1.9.3',
|
||||
'django-formtools>=1.0',
|
||||
'django-nine>=0.1.10',
|
||||
'django-nonefield>=0.1',
|
||||
'ordereddict>=1.1',
|
||||
'Pillow>=2.0.0',
|
||||
'requests>=1.0.0',
|
||||
'six>=1.9',
|
||||
'Unidecode>=0.04.1',
|
||||
'vishap>=0.1.5,<2.0',
|
||||
]
|
||||
elif DJANGO_1_10:
|
||||
install_requires = [
|
||||
'django-autoslug==1.9.3',
|
||||
'django-formtools>=1.0',
|
||||
'django-nine>=0.1.10',
|
||||
'django-nonefield>=0.1',
|
||||
'ordereddict>=1.1',
|
||||
'Pillow>=2.0.0',
|
||||
'requests>=1.0.0',
|
||||
'six>=1.9',
|
||||
'Unidecode>=0.04.1',
|
||||
'vishap>=0.1.5,<2.0',
|
||||
]
|
||||
# Fall back to the latest dependencies
|
||||
if not install_requires:
|
||||
install_requires = [
|
||||
'django-autoslug>=1.9.3',
|
||||
'django-formtools>=1.0',
|
||||
'django-nine>=0.1.10',
|
||||
'django-nonefield>=0.1',
|
||||
'ordereddict>=1.1',
|
||||
'Pillow>=2.0.0',
|
||||
'requests>=1.0.0',
|
||||
'six>=1.9',
|
||||
'Unidecode>=0.04.1',
|
||||
'vishap>=0.1.5,<2.0',
|
||||
]
|
||||
|
||||
# There are also conditional PY3/PY2 requirements. Scroll down to see them.
|
||||
|
||||
|
|
@ -165,7 +284,7 @@ try:
|
|||
PY3 = sys.version_info[0] == 3
|
||||
if PY3:
|
||||
install_requires.append('simplejson>=3.0.0') # When using Python 3
|
||||
install_requires.append('easy-thumbnails>=2.1')
|
||||
install_requires.append('easy-thumbnails>=2.3')
|
||||
else:
|
||||
install_requires.append('simplejson>=2.1.0') # When using Python 2.*
|
||||
install_requires.append('easy-thumbnails>=1.4')
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
__title__ = 'django-fobi'
|
||||
__version__ = '0.8.4'
|
||||
__build__ = 0x00005b
|
||||
__version__ = '0.8.5'
|
||||
__build__ = 0x00005c
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
__copyright__ = '2014-2016 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
|
|
|
|||
|
|
@ -1,60 +1,70 @@
|
|||
===============================================
|
||||
=======================================
|
||||
fobi.contrib.apps.djangocms_integration
|
||||
===============================================
|
||||
=======================================
|
||||
A ``django-fobi`` integration with DjangoCMS.
|
||||
|
||||
Prerequisites
|
||||
===============================================
|
||||
Has been tested with DjangoCMS 2.4.3 and 3.0.6 only. Might work on earlier versions as well.
|
||||
=============
|
||||
Has been tested with DjangoCMS 2.4.3 and 3.0.6 only. Might work on earlier
|
||||
versions as well.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
Versions
|
||||
-----------------------------------------------
|
||||
See the requirements files:
|
||||
|
||||
- `DjangoCMS 2.4.3 requirements <https://github.com/barseghyanartur/django-fobi/blob/stable/examples/requirements_djangocms_2.txt>`_.
|
||||
- `DjangoCMS 3.0.6 requirements <https://github.com/barseghyanartur/django-fobi/blob/stable/examples/requirements_djangocms.txt>`_.
|
||||
- `DjangoCMS 2.4.3 requirements
|
||||
<https://github.com/barseghyanartur/django-fobi/blob/stable/examples/requirements_djangocms_2.txt>`_.
|
||||
- `DjangoCMS 3.0.6 requirements
|
||||
<https://github.com/barseghyanartur/django-fobi/blob/stable/examples/requirements_djangocms.txt>`_.
|
||||
|
||||
your_project/settings.py
|
||||
-----------------------------------------------
|
||||
------------------------
|
||||
See the example settings files:
|
||||
|
||||
- `DjangoCMS 2.4.3 settings <https://github.com/barseghyanartur/django-fobi/blob/stable/examples/simple/settings_bootstrap3_theme_djangocms_2.py>`_.
|
||||
- `DjangoCMS 3.0.6 settings <https://github.com/barseghyanartur/django-fobi/blob/stable/examples/simple/settings_bootstrap3_theme_djangocms.py>`_.
|
||||
- `DjangoCMS 2.4.3 settings
|
||||
<https://github.com/barseghyanartur/django-fobi/blob/stable/examples/simple/settings_bootstrap3_theme_djangocms_2.py>`_.
|
||||
- `DjangoCMS 3.0.6 settings
|
||||
<https://github.com/barseghyanartur/django-fobi/blob/stable/examples/simple/settings_bootstrap3_theme_djangocms.py>`_.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
INSTALLED_APPS = list(INSTALLED_APPS)
|
||||
INSTALLED_APPS += [
|
||||
'cms', # FeinCMS
|
||||
'cms', # FeinCMS
|
||||
|
||||
'fobi.contrib.apps.djangocms_integration', # Fobi DjangoCMS app
|
||||
'fobi.contrib.apps.djangocms_integration', # Fobi DjangoCMS app
|
||||
]
|
||||
|
||||
Information for developers
|
||||
===============================================
|
||||
==========================
|
||||
Templates for DjangoCMS
|
||||
-----------------------------------------------
|
||||
-----------------------
|
||||
Django-CMS templates are quite specific and in some aspects are not 100%
|
||||
compatible with built-in themes (due to the fact that DjangoCMS intensively
|
||||
makes use of ``django-sekizai`` which isn't used in the generic templates).
|
||||
|
||||
That does not anyhow affect the core ``fobi`` and the built-in themes,
|
||||
although you can't magically reuse built-in ``fobi`` themes with Django-CMS
|
||||
(as it's done for `FeinCMS page templates <https://github.com/barseghyanartur/django-fobi/blob/stable/examples/simple/templates/page/base.html>`_).
|
||||
(as it's done for `FeinCMS page templates
|
||||
<https://github.com/barseghyanartur/django-fobi/blob/stable/examples/simple/templates/page/base.html>`_).
|
||||
|
||||
You would have to make custom page templates from scratch (or based on a
|
||||
copy of the desired bundled template). See how I did it for all bundled themes
|
||||
`here <https://github.com/barseghyanartur/django-fobi/tree/stable/examples/simple/templates/cms_page>`_:
|
||||
`here
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/stable/examples/simple/templates/cms_page>`_:
|
||||
|
||||
- `Bootstrap 3 <https://github.com/barseghyanartur/django-fobi/tree/stable/examples/simple/templates/cms_page/bootstrap3>`_
|
||||
- `Foundation 5 <https://github.com/barseghyanartur/django-fobi/tree/stable/examples/simple/templates/cms_page/foundation5>`_
|
||||
- `Simple <https://github.com/barseghyanartur/django-fobi/tree/stable/examples/simple/templates/cms_page/simple>`_
|
||||
- `Bootstrap 3
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/stable/examples/simple/templates/cms_page/bootstrap3>`_
|
||||
- `Foundation 5
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/stable/examples/simple/templates/cms_page/foundation5>`_
|
||||
- `Simple
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/stable/examples/simple/templates/cms_page/simple>`_
|
||||
|
||||
Template rendering
|
||||
-----------------------------------------------
|
||||
The embed DjagnoCMS widget is rendered with use of two theme templates:
|
||||
------------------
|
||||
The embed DjangoCMS widget is rendered with use of two theme templates:
|
||||
|
||||
- ``view_embed_form_entry_ajax_template``: Used for rendering the form.
|
||||
- ``embed_form_entry_submitted_ajax_template``: Used for rendering the form
|
||||
|
|
@ -122,7 +132,7 @@ example below.
|
|||
}
|
||||
|
||||
Usage
|
||||
===============================================
|
||||
=====
|
||||
The ``fobi.contrib.apps.djangocms_integration.models.FobiFormWidget`` consists
|
||||
of the following fields:
|
||||
|
||||
|
|
|
|||
|
|
@ -1,27 +1,29 @@
|
|||
===============================================
|
||||
=====================================
|
||||
fobi.contrib.apps.feincms_integration
|
||||
===============================================
|
||||
=====================================
|
||||
A ``django-fobi`` integration with FeinCMS.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
Versions
|
||||
-----------------------------------------------
|
||||
See the `requirements file <https://github.com/barseghyanartur/django-fobi/blob/stable/examples/requirements_feincms.txt>`_.
|
||||
See the `requirements file
|
||||
<https://github.com/barseghyanartur/django-fobi/blob/stable/examples/requirements_feincms.txt>`_.
|
||||
|
||||
your_project/settings.py
|
||||
-----------------------------------------------
|
||||
See the `example settings file <https://github.com/barseghyanartur/django-fobi/blob/stable/examples/simple/settings_bootstrap3_theme_feincms.py>`_.
|
||||
See the `example settings file
|
||||
<https://github.com/barseghyanartur/django-fobi/blob/stable/examples/simple/settings_bootstrap3_theme_feincms.py>`_.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
INSTALLED_APPS = list(INSTALLED_APPS)
|
||||
INSTALLED_APPS += [
|
||||
'feincms', # FeinCMS
|
||||
'feincms', # FeinCMS
|
||||
|
||||
'fobi.contrib.apps.feincms_integration', # Fobi FeinCMS app
|
||||
'fobi.contrib.apps.feincms_integration', # Fobi FeinCMS app
|
||||
|
||||
'page', # Example
|
||||
'page', # Example
|
||||
]
|
||||
|
||||
FEINCMS_RICHTEXT_INIT_CONTEXT = {
|
||||
|
|
@ -29,7 +31,7 @@ See the `example settings file <https://github.com/barseghyanartur/django-fobi/b
|
|||
}
|
||||
|
||||
your_project/page/models.py
|
||||
-----------------------------------------------
|
||||
---------------------------
|
||||
.. code-block:: python
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
|
@ -63,7 +65,7 @@ your_project/page/models.py
|
|||
Page.create_content_type(FobiFormWidget)
|
||||
|
||||
your_project/admin.py
|
||||
-----------------------------------------------
|
||||
---------------------
|
||||
.. code-block:: python
|
||||
|
||||
from django.contrib import admin
|
||||
|
|
@ -75,16 +77,15 @@ your_project/admin.py
|
|||
admin.site.register(Page, PageAdmin)
|
||||
|
||||
Information for developers
|
||||
===============================================
|
||||
==========================
|
||||
Template rendering
|
||||
-----------------------------------------------
|
||||
------------------
|
||||
The embed FeinCMS widget is rendered with use of two theme templates:
|
||||
|
||||
- ``view_embed_form_entry_ajax_template``: Used for rendering the form.
|
||||
- ``embed_form_entry_submitted_ajax_template``: Used for rendering the form
|
||||
sent event.
|
||||
|
||||
|
||||
Using custom templates for rendering the widget
|
||||
-----------------------------------------------
|
||||
In the widget, you can specify a template which you want to be used for
|
||||
|
|
@ -147,7 +148,7 @@ example below.
|
|||
}
|
||||
|
||||
Usage
|
||||
===============================================
|
||||
=====
|
||||
The ``fobi.contrib.apps.feincms_integration.widgets.FobiFormWidget`` consists
|
||||
of the following fields:
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
===============================================
|
||||
=======================================
|
||||
fobi.contrib.apps.mezzanine_integration
|
||||
===============================================
|
||||
=======================================
|
||||
A ``django-fobi`` integration with Mezzanine.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
Versions
|
||||
-----------------------------------------------
|
||||
--------
|
||||
See the `requirements file
|
||||
<https://github.com/barseghyanartur/django-fobi/blob/stable/examples/mezzanine_example/requirements.txt>`_.
|
||||
|
||||
|
|
@ -21,13 +21,13 @@ See the `example settings file
|
|||
INSTALLED_APPS += [
|
||||
# Standard mezzanine apps
|
||||
|
||||
'fobi.contrib.apps.mezzanine_integration', # Fobi Mezzanine app
|
||||
'fobi.contrib.apps.mezzanine_integration', # Fobi Mezzanine app
|
||||
]
|
||||
|
||||
Information for developers
|
||||
===============================================
|
||||
==========================
|
||||
Template rendering
|
||||
-----------------------------------------------
|
||||
------------------
|
||||
The form embed into Mezzanine page is rendered with use of two theme templates:
|
||||
|
||||
- ``view_embed_form_entry_ajax_template``: Used for rendering the form.
|
||||
|
|
@ -35,7 +35,7 @@ The form embed into Mezzanine page is rendered with use of two theme templates:
|
|||
sent event.
|
||||
|
||||
Using custom templates for rendering the form
|
||||
-----------------------------------------------
|
||||
---------------------------------------------
|
||||
In the widget, you can specify a template which you want to be used for
|
||||
rendering the form or the form-sent event.
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ example below.
|
|||
}
|
||||
|
||||
Usage
|
||||
===============================================
|
||||
=====
|
||||
The ``fobi`` page model
|
||||
-----------------------------------------------
|
||||
The ``fobi.contrib.apps.mezzanine_integration.models.FobiFormPage`` consists
|
||||
|
|
@ -114,7 +114,7 @@ of the following fields:
|
|||
- Success page text: Overrides the form-sent text.
|
||||
|
||||
Steps described
|
||||
-----------------------------------------------
|
||||
---------------
|
||||
1. If you use the mezzanine `example
|
||||
<https://github.com/barseghyanartur/django-fobi/blob/stable/examples/mezzanine_example/>`_
|
||||
project, to start go to the http://localhost:8003/fobi/ URL and create a
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ fobi.contrib.plugins.form_elements.content.content_image
|
|||
A ``Fobi`` Image form element plugin.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.content.content_image`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -81,10 +81,7 @@ class ContentImagePlugin(FormElementPlugin):
|
|||
'label': '',
|
||||
}
|
||||
|
||||
form_field_instances = []
|
||||
|
||||
form_field_instances.append((self.data.name, NoneField, kwargs))
|
||||
return form_field_instances
|
||||
return [(self.data.name, NoneField, kwargs)]
|
||||
|
||||
|
||||
form_element_plugin_registry.register(ContentImagePlugin)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ fobi.contrib.plugins.form_elements.content.content_text
|
|||
A ``Fobi`` Text form element plugin.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.content.content_text`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -41,10 +41,7 @@ class ContentTextPlugin(FormElementPlugin):
|
|||
'label': '',
|
||||
}
|
||||
|
||||
form_field_instances = []
|
||||
|
||||
form_field_instances.append((self.data.name, NoneField, kwargs))
|
||||
return form_field_instances
|
||||
return [(self.data.name, NoneField, kwargs)]
|
||||
|
||||
|
||||
form_element_plugin_registry.register(ContentTextPlugin)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ fobi.contrib.plugins.form_elements.content.content_video
|
|||
A ``Fobi`` Video form element plugin.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.content.content_video`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -46,10 +46,7 @@ class ContentVideoPlugin(FormElementPlugin):
|
|||
'label': '',
|
||||
}
|
||||
|
||||
form_field_instances = []
|
||||
|
||||
form_field_instances.append((self.data.name, NoneField, kwargs))
|
||||
return form_field_instances
|
||||
return [(self.data.name, NoneField, kwargs)]
|
||||
|
||||
|
||||
form_element_plugin_registry.register(ContentVideoPlugin)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ A ``Fobi`` Boolean form field plugin. Makes use of the
|
|||
``django.forms.fields.BooleanField``.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.boolean`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ A ``Fobi`` Select Multiple form field plugin. Makes use of the
|
|||
``django.forms.widgets.CheckboxSelectMultiple``.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.checkbox_select_multiple``
|
||||
to the ``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ Installation
|
|||
the following values: "val", "repr" or "mix" to get the desired behaviour.
|
||||
|
||||
Usage
|
||||
===============================================
|
||||
=====
|
||||
You should be entering a single choice per line. Choice might
|
||||
consist of just a single value or value/label pair.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
===============================================
|
||||
==============================================
|
||||
fobi.contrib.plugins.form_elements.fields.date
|
||||
===============================================
|
||||
==============================================
|
||||
A ``Fobi`` Date form field plugin. Makes use of the
|
||||
``django.forms.fields.DateField`` and ``django.forms.widgets.DateInput``.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.date`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
from __future__ import absolute_import
|
||||
|
||||
from fobi.base import FormElementPluginWidget
|
||||
from fobi.contrib.plugins.form_elements.fields.date import UID
|
||||
|
||||
from . import UID
|
||||
|
||||
__title__ = 'fobi.contrib.plugins.form_elements.fields.date.widgets'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ A ``Fobi`` Birthday form field plugin. Makes use of the
|
|||
``django.forms.extras.widgets.SelectDateWidget``.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.date_drop_down`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ A ``Fobi`` DateTime form field plugin. Makes use of the
|
|||
``django.forms.widgets.DateTimeInput``.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.datetime`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ A ``Fobi`` Decimal form field plugin. Makes use of the
|
|||
versions).
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.decimal`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ A ``Fobi`` Email form field plugin. Makes use of the
|
|||
``django.forms.fields.EmailField`` and ``django.forms.widgets.TextInput``.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.email`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
===============================================
|
||||
==============================================
|
||||
fobi.contrib.plugins.form_elements.fields.file
|
||||
===============================================
|
||||
==============================================
|
||||
A ``Fobi`` File form field plugin. Makes use of the
|
||||
``django.forms.fields.FileField`` and
|
||||
``django.forms.widgets.ClearableFileInput``.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.file`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
=================================================
|
||||
===============================================
|
||||
fobi.contrib.plugins.form_elements.fields.float
|
||||
=================================================
|
||||
===============================================
|
||||
A ``Fobi`` Integer form field plugin. Makes use of the
|
||||
``django.forms.fields.FloatField`` and ``django.forms.widgets.NumberInput``
|
||||
(falling back to ``django.forms.widgets.TextInput`` for older Django
|
||||
versions).
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.float`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ A ``Fobi`` Hidden form field plugin. Makes use of the
|
|||
``django.forms.fields.CharField`` and ``django.forms.widgets.HiddenInput``.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.hidden`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ See `w3schools.com <http://www.w3schools.com/tags/tag_input.asp>`_ for further
|
|||
explanations.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.input`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ A ``Fobi`` Integer form field plugin. Makes use of the
|
|||
versions).
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.integer`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ A ``Fobi`` Text form field plugin. Makes use of the
|
|||
``django.forms.widgets.TextInput``.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.ip_address`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ A ``Fobi`` NullBoolean form field plugin. Makes use of the
|
|||
``django.forms.widgets.NullBooleanSelect``.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.null_boolean`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ A ``Fobi`` Password form field plugin. Makes use of the
|
|||
``django.forms.fields.CharField`` and ``django.forms.widgets.PasswordInput``.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.password`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ A ``Fobi`` Radio form field plugin. Makes use of the
|
|||
``django.forms.fields.ChoiceField`` and ``django.forms.widgets.RadioSelect``.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.radio`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ Installation
|
|||
|
||||
4. By default, the submitted form value of `radio`
|
||||
elements is label (human readable representation of the value chosen).
|
||||
However, that part of the bahaviour has been made configurable. You can
|
||||
However, that part of the behaviour has been made configurable. You can
|
||||
choose between the following options:
|
||||
|
||||
Consider the following list of (value, label) choices (the first element in
|
||||
|
|
@ -44,14 +44,14 @@ Installation
|
|||
|
||||
- "val": `value` (example: "alpha").
|
||||
- "repr" (default): `label` (example: "Alpha").
|
||||
- "mix": `value (label)` (examle: "Alpha (alpha)").
|
||||
- "mix": `value (label)` (example: "Alpha (alpha)").
|
||||
|
||||
Simply set the
|
||||
``FOBI_FORM_ELEMENT_RADIO_SUBMIT_VALUE_AS`` assign one of the following
|
||||
values: "val", "repr" or "mix" to get the desired behaviour.
|
||||
|
||||
Usage
|
||||
===============================================
|
||||
=====
|
||||
You should be entering a single choice per line. Choice might
|
||||
consist of just a single value or value/label pair.
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
======================================================
|
||||
fobi.contrib.plugins.form_elements.fields.range_select
|
||||
======================================================
|
||||
A ``Fobi`` RangeSelect form field plugin. Makes use of the
|
||||
``django.forms.fields.ChoiceField`` and ``django.forms.widgets.Select``.
|
||||
|
||||
Installation
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.range_select`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
INSTALLED_APPS = (
|
||||
# ...
|
||||
'fobi.contrib.plugins.form_elements.fields.range_select',
|
||||
# ...
|
||||
)
|
||||
|
||||
2. In the terminal type:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
$ ./manage.py fobi_sync_plugins
|
||||
|
||||
3. Assign appropriate permissions to the target users/groups to be using
|
||||
the plugin if ``FOBI_RESTRICT_PLUGIN_ACCESS`` is set to True.
|
||||
|
||||
4. Ranges are specified within the given min/max values. The default values
|
||||
are:
|
||||
|
||||
- INITIAL: 50
|
||||
- MIN_VALUE: 0
|
||||
- MAX_VALUE: 100
|
||||
- STEP: 1
|
||||
|
||||
However, you can override each of them in the settings of your project by
|
||||
prefixing correspondent names with `FOBI_FORM_ELEMENT_RANGE_SELECT_`:
|
||||
|
||||
- FOBI_FORM_ELEMENT_RANGE_SELECT_INITIAL
|
||||
- FOBI_FORM_ELEMENT_RANGE_SELECT_MIN_VALUE
|
||||
- FOBI_FORM_ELEMENT_RANGE_SELECT_MAX_VALUE
|
||||
- FOBI_FORM_ELEMENT_RANGE_SELECT_STEP
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
__title__ = 'fobi.contrib.plugins.form_elements.fields.range_select'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
__copyright__ = '2014-2016 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = ('default_app_config', 'UID',)
|
||||
|
||||
default_app_config = 'fobi.contrib.plugins.form_elements.fields.' \
|
||||
'range_select.apps.Config'
|
||||
|
||||
UID = 'range_select'
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
__title__ = 'fobi.contrib.plugins.form_elements.fields.range_select.apps'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
__copyright__ = '2014-2016 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = ('Config',)
|
||||
|
||||
try:
|
||||
from django.apps import AppConfig
|
||||
|
||||
class Config(AppConfig):
|
||||
"""Config."""
|
||||
|
||||
name = 'fobi.contrib.plugins.form_elements.fields.range_select'
|
||||
label = 'fobi_contrib_plugins_form_elements_fields_range_select'
|
||||
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
from django.conf import settings
|
||||
|
||||
from . import defaults
|
||||
|
||||
__title__ = 'fobi.contrib.plugins.form_elements.fields.' \
|
||||
'range_select.conf'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
__copyright__ = '2014-2016 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = ('get_setting',)
|
||||
|
||||
|
||||
def get_setting(setting, override=None):
|
||||
"""Get setting.
|
||||
|
||||
Get a setting from
|
||||
`fobi.contrib.plugins.form_elements.fields.range_select` conf
|
||||
module, falling back to the default.
|
||||
|
||||
If override is not None, it will be used instead of the setting.
|
||||
|
||||
:param setting: String with setting name
|
||||
:param override: Value to use when no setting is available. Defaults
|
||||
to None.
|
||||
:return: Setting value.
|
||||
"""
|
||||
if override is not None:
|
||||
return override
|
||||
if hasattr(settings,
|
||||
'FOBI_FORM_ELEMENT_RANGE_SELECT_{0}'.format(setting)):
|
||||
return getattr(
|
||||
settings,
|
||||
'FOBI_FORM_ELEMENT_RANGE_SELECT_{0}'.format(setting)
|
||||
)
|
||||
else:
|
||||
return getattr(defaults, setting)
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
__title__ = 'fobi.contrib.plugins.form_elements.fields.' \
|
||||
'range_select.defaults'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
__copyright__ = '2014-2016 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = (
|
||||
'INITIAL',
|
||||
'MAX_VALUE',
|
||||
'MIN_VALUE',
|
||||
'STEP',
|
||||
)
|
||||
|
||||
INITIAL = 50
|
||||
MIN_VALUE = 0
|
||||
MAX_VALUE = 100
|
||||
STEP = 1
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
from django.forms.fields import ChoiceField
|
||||
from django.forms.widgets import Select
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from fobi.base import FormFieldPlugin, form_element_plugin_registry, get_theme
|
||||
|
||||
from . import UID
|
||||
from .forms import RangeSelectInputForm
|
||||
from .settings import INITIAL, MAX_VALUE, MIN_VALUE, STEP
|
||||
|
||||
__title__ = 'fobi.contrib.plugins.form_elements.fields.' \
|
||||
'range_select.fobi_form_elements'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
__copyright__ = '2014-2016 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = ('RangeSelectInputPlugin',)
|
||||
|
||||
theme = get_theme(request=None, as_instance=True)
|
||||
|
||||
|
||||
class RangeSelectInputPlugin(FormFieldPlugin):
|
||||
"""Percentage field plugin."""
|
||||
|
||||
uid = UID
|
||||
name = _("Range select")
|
||||
group = _("Fields")
|
||||
form = RangeSelectInputForm
|
||||
|
||||
def get_form_field_instances(self, request=None):
|
||||
"""Get form field instances."""
|
||||
initial = self.data.initial if self.data.initial else INITIAL
|
||||
max_value = self.data.max_value if self.data.max_value else MAX_VALUE
|
||||
min_value = self.data.min_value if self.data.min_value else MIN_VALUE
|
||||
step = self.data.step if self.data.step else STEP
|
||||
|
||||
_choices = range(min_value, max_value, step)
|
||||
choices = zip(_choices, _choices)
|
||||
|
||||
kwargs = {
|
||||
'label': self.data.label,
|
||||
'help_text': self.data.help_text,
|
||||
'initial': initial,
|
||||
'required': self.data.required,
|
||||
'choices': choices,
|
||||
'widget': Select(attrs={'class': theme.form_element_html_class}),
|
||||
}
|
||||
|
||||
return [(self.data.name, ChoiceField, kwargs)]
|
||||
|
||||
|
||||
form_element_plugin_registry.register(RangeSelectInputPlugin)
|
||||
|
|
@ -0,0 +1,129 @@
|
|||
from django import forms
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from fobi.base import BaseFormFieldPluginForm, get_theme
|
||||
|
||||
from .settings import INITIAL, MAX_VALUE, MIN_VALUE, STEP
|
||||
|
||||
__title__ = 'fobi.contrib.plugins.form_elements.fields.range_select.forms'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
__copyright__ = '2014-2015 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = ('RangeSelectInputForm',)
|
||||
|
||||
theme = get_theme(request=None, as_instance=True)
|
||||
|
||||
|
||||
class RangeSelectInputForm(forms.Form, BaseFormFieldPluginForm):
|
||||
"""Form for ``RangeSelectInputPlugin``."""
|
||||
|
||||
plugin_data_fields = [
|
||||
("label", ""),
|
||||
("name", ""),
|
||||
("min_value", MIN_VALUE),
|
||||
("max_value", MAX_VALUE),
|
||||
("step", STEP),
|
||||
("help_text", ""),
|
||||
("initial", INITIAL),
|
||||
("required", False)
|
||||
]
|
||||
|
||||
label = forms.CharField(
|
||||
label=_("Label"),
|
||||
required=True,
|
||||
widget=forms.widgets.TextInput(
|
||||
attrs={'class': theme.form_element_html_class}
|
||||
)
|
||||
)
|
||||
name = forms.CharField(
|
||||
label=_("Name"),
|
||||
required=True,
|
||||
widget=forms.widgets.TextInput(
|
||||
attrs={'class': theme.form_element_html_class}
|
||||
)
|
||||
)
|
||||
min_value = forms.IntegerField(
|
||||
label=_("Min value"),
|
||||
required=True,
|
||||
widget=forms.widgets.TextInput(
|
||||
attrs={'class': theme.form_element_html_class}
|
||||
),
|
||||
min_value=MIN_VALUE,
|
||||
max_value=MAX_VALUE
|
||||
)
|
||||
max_value = forms.IntegerField(
|
||||
label=_("Max value"),
|
||||
required=True,
|
||||
widget=forms.widgets.TextInput(
|
||||
attrs={'class': theme.form_element_html_class}
|
||||
),
|
||||
min_value=MIN_VALUE,
|
||||
max_value=MAX_VALUE
|
||||
)
|
||||
step = forms.IntegerField(
|
||||
label=_("Step"),
|
||||
required=True,
|
||||
help_text=_("Step size"),
|
||||
widget=forms.widgets.TextInput(
|
||||
attrs={'class': theme.form_element_html_class}
|
||||
),
|
||||
min_value=MIN_VALUE,
|
||||
max_value=MAX_VALUE
|
||||
)
|
||||
help_text = forms.CharField(
|
||||
label=_("Help text"),
|
||||
required=False,
|
||||
widget=forms.widgets.TextInput(
|
||||
attrs={'class': theme.form_element_html_class}
|
||||
)
|
||||
)
|
||||
initial = forms.IntegerField(
|
||||
label=_("Initial"),
|
||||
required=False,
|
||||
widget=forms.widgets.TextInput(
|
||||
attrs={'class': theme.form_element_html_class}
|
||||
),
|
||||
min_value=MIN_VALUE,
|
||||
max_value=MAX_VALUE,
|
||||
initial=INITIAL
|
||||
)
|
||||
required = forms.BooleanField(
|
||||
label=_("Required"),
|
||||
required=False,
|
||||
widget=forms.widgets.CheckboxInput(
|
||||
attrs={'class': theme.form_element_checkbox_html_class}
|
||||
)
|
||||
)
|
||||
|
||||
def clean(self):
|
||||
"""Validating the values."""
|
||||
super(RangeSelectInputForm, self).clean()
|
||||
|
||||
max_value = self.cleaned_data['max_value']
|
||||
min_value = self.cleaned_data['min_value']
|
||||
initial = self.cleaned_data['initial']
|
||||
step = self.cleaned_data['step']
|
||||
|
||||
if max_value < min_value:
|
||||
self.add_error(
|
||||
'max_value',
|
||||
_("`max_value` should be > than `min_value`.")
|
||||
)
|
||||
|
||||
if step > max_value - min_value:
|
||||
self.add_error(
|
||||
'step',
|
||||
_("`step` should be > than `max_value` - `min_value`.")
|
||||
)
|
||||
|
||||
if max_value < initial:
|
||||
self.add_error(
|
||||
'initial',
|
||||
_("`max_value` should be >= than `initial`.")
|
||||
)
|
||||
|
||||
if min_value > initial:
|
||||
self.add_error(
|
||||
'min_value',
|
||||
_("`initial` should be >= than `min_value`.")
|
||||
)
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
from .conf import get_setting
|
||||
|
||||
__title__ = 'fobi.contrib.plugins.form_elements.fields.' \
|
||||
'range_select.settings'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
__copyright__ = '2014-2016 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = (
|
||||
'INITIAL',
|
||||
'MAX_VALUE',
|
||||
'MIN_VALUE',
|
||||
'STEP',
|
||||
)
|
||||
|
||||
INITIAL = get_setting('INITIAL')
|
||||
|
||||
MAX_VALUE = get_setting('MAX_VALUE')
|
||||
|
||||
MIN_VALUE = get_setting('MIN_VALUE')
|
||||
|
||||
STEP = get_setting('STEP')
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
================================================
|
||||
===============================================
|
||||
fobi.contrib.plugins.form_elements.fields.regex
|
||||
================================================
|
||||
===============================================
|
||||
A ``Fobi`` Text form field plugin. Makes use of the
|
||||
``django.forms.fields.RegexField`` and ``django.forms.widgets.TextInput``.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.regex`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ A ``Fobi`` Select form field plugin. Makes use of the
|
|||
``django.forms.fields.ChoiceField`` and ``django.forms.widgets.Select``.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.select`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ Installation
|
|||
|
||||
4. By default, the submitted form value of `select`
|
||||
elements is label (human readable representation of the value chosen).
|
||||
However, that part of the bahaviour has been made configurable. You can
|
||||
However, that part of the behaviour has been made configurable. You can
|
||||
choose between the following options:
|
||||
|
||||
Consider the following list of (value, label) choices (the first element in
|
||||
|
|
@ -44,14 +44,14 @@ Installation
|
|||
|
||||
- "val": `value` (example: "alpha").
|
||||
- "repr" (default): `label` (example: "Alpha").
|
||||
- "mix": `value (label)` (examle: "Alpha (alpha)").
|
||||
- "mix": `value (label)` (example: "Alpha (alpha)").
|
||||
|
||||
Simply set the
|
||||
``FOBI_FORM_ELEMENT_SELECT_SUBMIT_VALUE_AS`` assign one of the following
|
||||
values: "val", "repr" or "mix" to get the desired behaviour.
|
||||
|
||||
Usage
|
||||
===============================================
|
||||
=====
|
||||
You should be entering a single choice per line. Choice might
|
||||
consist of just a single value or value/label pair.
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ A ``Fobi`` Select Model Object form field plugin. Makes use of the
|
|||
``django.forms.models.ModelChoiceField`` and ``django.forms.widgets.Select``.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.select_model_object`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
@ -39,11 +39,11 @@ Installation
|
|||
|
||||
5. By default, the submitted form value of `select_model_object` elements is
|
||||
`app_label.model_name.object_pk.object_repr`. However, that part of the
|
||||
bahaviour has been made configurable. You can choose between the following
|
||||
behaviour has been made configurable. You can choose between the following
|
||||
options:
|
||||
|
||||
- "val": `app_label.model_name.object_pk.object_repr`.
|
||||
- "repr": `object_repr` (uses the ``__unicode__`` nethod of the model).
|
||||
- "repr": `object_repr` (uses the ``__unicode__`` method of the model).
|
||||
- "mix" (default): `app_label.model_name.object_pk.object_repr`.
|
||||
|
||||
Simply set the ``FOBI_FORM_ELEMENT_SELECT_MODEL_OBJECT_SUBMIT_VALUE_AS``
|
||||
|
|
|
|||
|
|
@ -56,11 +56,11 @@ Install `select_mptt_model_object` plugin
|
|||
|
||||
5. By default, the submitted form value of `select_mptt_model_object` elements
|
||||
is `app_label.model_name.object_pk.object_repr`. However, that part of the
|
||||
bahaviour has been made configurable. You can choose between the following
|
||||
behaviour has been made configurable. You can choose between the following
|
||||
options:
|
||||
|
||||
- "val": `app_label.model_name.object_pk.object_repr`.
|
||||
- "repr": `object_repr` (uses the ``__unicode__`` nethod of the model).
|
||||
- "repr": `object_repr` (uses the ``__unicode__`` method of the model).
|
||||
- "mix" (default): `app_label.model_name.object_pk.object_repr`.
|
||||
|
||||
Simply set the ``FOBI_FORM_ELEMENT_SELECT_MPTT_MODEL_OBJECT_SUBMIT_VALUE_AS``
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ A ``Fobi`` Select Multiple form field plugin. Makes use of the
|
|||
``django.forms.widgets.SelectMultiple``.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.select_multiple`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ Installation
|
|||
|
||||
4. By default, the submitted form value of `select_multiple`
|
||||
elements is label (human readable representation of the value chosen).
|
||||
However, that part of the bahaviour has been made configurable. You can
|
||||
However, that part of the behaviour has been made configurable. You can
|
||||
choose between the following options:
|
||||
|
||||
Consider the following list of (value, label) choices (the first element in
|
||||
|
|
@ -45,14 +45,14 @@ Installation
|
|||
|
||||
- "val": `value` (example: "alpha").
|
||||
- "repr" (default): `label` (example: "Alpha").
|
||||
- "mix": `value (label)` (examle: "Alpha (alpha)").
|
||||
- "mix": `value (label)` (example: "Alpha (alpha)").
|
||||
|
||||
Simply set the
|
||||
``FOBI_FORM_ELEMENT_SELECT_MULTIPLE_SUBMIT_VALUE_AS`` assign one of the
|
||||
following values: "val", "repr" or "mix" to get the desired behaviour.
|
||||
|
||||
Usage
|
||||
===============================================
|
||||
=====
|
||||
You should be entering a single choice per line. Choice might
|
||||
consist of just a single value or value/label pair.
|
||||
|
||||
|
|
|
|||
|
|
@ -41,11 +41,11 @@ Installation
|
|||
|
||||
5. By default, the submitted form value of `select_multiple_model_objects`
|
||||
elements is `app_label.model_name.object_pk.object_repr`. However, that part
|
||||
of the bahaviour has been made configurable. You can choose between the
|
||||
of the behaviour has been made configurable. You can choose between the
|
||||
following options:
|
||||
|
||||
- "val": `app_label.model_name.object_pk.object_repr`.
|
||||
- "repr": `object_repr` (uses the ``__unicode__`` nethod of the model).
|
||||
- "repr": `object_repr` (uses the ``__unicode__`` method of the model).
|
||||
- "mix" (default): `app_label.model_name.object_pk.object_repr`.
|
||||
|
||||
Simply set the
|
||||
|
|
|
|||
|
|
@ -57,11 +57,11 @@ Install `select_multiple_mptt_model_objects` plugin
|
|||
|
||||
5. By default, the submitted form value of `select_multiple_mptt_model_objects`
|
||||
elements is `app_label.model_name.object_pk.object_repr`. However, that part
|
||||
of the bahaviour has been made configurable. You can choose between the
|
||||
of the behaviour has been made configurable. You can choose between the
|
||||
following options:
|
||||
|
||||
- "val": `app_label.model_name.object_pk.object_repr`.
|
||||
- "repr": `object_repr` (uses the ``__unicode__`` nethod of the model).
|
||||
- "repr": `object_repr` (uses the ``__unicode__`` method of the model).
|
||||
- "mix" (default): `app_label.model_name.object_pk.object_repr`.
|
||||
|
||||
Simply set the
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
=========================================================
|
||||
==================================================================
|
||||
fobi.contrib.plugins.form_elements.fields.select_multiple_with_max
|
||||
=========================================================
|
||||
A ``Fobi`` Select Multiple form field plugin with max choices. Makes use of the
|
||||
``django.forms.widgets.SelectMultiple``.
|
||||
==================================================================
|
||||
A ``Fobi`` Select Multiple form field plugin with max choices. Makes use of
|
||||
the ``django.forms.widgets.SelectMultiple``.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.select_multiple_with_max`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.select_multiple_with_max``
|
||||
to the ``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ Installation
|
|||
|
||||
4. By default, the submitted form value of `select_multiple_with_max`
|
||||
elements is label (human readable representation of the value chosen).
|
||||
However, that part of the bahaviour has been made configurable. You can
|
||||
However, that part of the behaviour has been made configurable. You can
|
||||
choose between the following options:
|
||||
|
||||
Consider the following list of (value, label) choices (the first element in
|
||||
|
|
@ -44,14 +44,14 @@ Installation
|
|||
|
||||
- "val": `value` (example: "alpha").
|
||||
- "repr" (default): `label` (example: "Alpha").
|
||||
- "mix": `value (label)` (examle: "Alpha (alpha)").
|
||||
- "mix": `value (label)` (example: "Alpha (alpha)").
|
||||
|
||||
Simply set the
|
||||
``FOBI_FORM_ELEMENT_SELECT_MULTIPLE_WITH_MAX_SUBMIT_VALUE_AS`` assign one of the
|
||||
following values: "val", "repr" or "mix" to get the desired behaviour.
|
||||
|
||||
Usage
|
||||
===============================================
|
||||
=====
|
||||
You should be entering a single choice per line. Choice might
|
||||
consist of just a single value or value/label pair. If you enter an integer in
|
||||
the 'max_choices' field, the user can choose only <max_choices> or less choices.
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ from django.utils.translation import ugettext_lazy as _
|
|||
|
||||
from fobi.base import BaseFormFieldPluginForm, get_theme
|
||||
from fobi.helpers import validate_initial_for_multiple_choices
|
||||
from fobi.widgets import NumberInput
|
||||
|
||||
__title__ = 'fobi.contrib.plugins.form_elements.fields.select_multiple.forms'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
|
|
@ -95,7 +96,7 @@ class SelectMultipleWithMaxInputForm(forms.Form, BaseFormFieldPluginForm):
|
|||
max_choices = forms.IntegerField(
|
||||
label=_("Max choices"),
|
||||
required=False,
|
||||
widget=forms.widgets.NumberInput(
|
||||
widget=NumberInput(
|
||||
attrs={'class': theme.form_element_html_class}
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
================================================
|
||||
fobi.contrib.plugins.form_elements.fields.slider
|
||||
================================================
|
||||
A ``Fobi`` Percentage form field plugin. Makes use of the
|
||||
``django.forms.fields.ChoiceField`` and ``django.forms.widgets.Select``.
|
||||
|
||||
Installation
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.slider`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
INSTALLED_APPS = (
|
||||
# ...
|
||||
'fobi.contrib.plugins.form_elements.fields.slider',
|
||||
# ...
|
||||
)
|
||||
|
||||
2. In the terminal type:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
$ ./manage.py fobi_sync_plugins
|
||||
|
||||
3. Assign appropriate permissions to the target users/groups to be using
|
||||
the plugin if ``FOBI_RESTRICT_PLUGIN_ACCESS`` is set to True.
|
||||
|
||||
4. Ranges are specified within the given min/max values. The default values
|
||||
are:
|
||||
|
||||
- INITIAL: 50
|
||||
- MIN_VALUE: 0
|
||||
- MAX_VALUE: 100
|
||||
- STEP: 1
|
||||
|
||||
However, you can override each of them in the settings of your project by
|
||||
prefixing correspondent names with `FOBI_FORM_ELEMENT_SLIDER_`:
|
||||
|
||||
- FOBI_FORM_ELEMENT_SLIDER_INITIAL
|
||||
- FOBI_FORM_ELEMENT_SLIDER_MIN_VALUE
|
||||
- FOBI_FORM_ELEMENT_SLIDER_MAX_VALUE
|
||||
- FOBI_FORM_ELEMENT_SLIDER_STEP
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
__title__ = 'fobi.contrib.plugins.form_elements.fields.slider'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
__copyright__ = '2014-2016 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = ('default_app_config', 'UID',)
|
||||
|
||||
default_app_config = 'fobi.contrib.plugins.form_elements.fields.' \
|
||||
'slider.apps.Config'
|
||||
|
||||
UID = 'slider'
|
||||
17
src/fobi/contrib/plugins/form_elements/fields/slider/apps.py
Normal file
17
src/fobi/contrib/plugins/form_elements/fields/slider/apps.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
__title__ = 'fobi.contrib.plugins.form_elements.fields.slider.apps'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
__copyright__ = '2014-2016 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = ('Config',)
|
||||
|
||||
try:
|
||||
from django.apps import AppConfig
|
||||
|
||||
class Config(AppConfig):
|
||||
"""Config."""
|
||||
|
||||
name = 'fobi.contrib.plugins.form_elements.fields.slider'
|
||||
label = 'fobi_contrib_plugins_form_elements_fields_slider'
|
||||
|
||||
except ImportError:
|
||||
pass
|
||||
35
src/fobi/contrib/plugins/form_elements/fields/slider/conf.py
Normal file
35
src/fobi/contrib/plugins/form_elements/fields/slider/conf.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
from django.conf import settings
|
||||
|
||||
from . import defaults
|
||||
|
||||
__title__ = 'fobi.contrib.plugins.form_elements.fields.' \
|
||||
'slider.conf'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
__copyright__ = '2014-2016 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = ('get_setting',)
|
||||
|
||||
|
||||
def get_setting(setting, override=None):
|
||||
"""Get setting.
|
||||
|
||||
Get a setting from `fobi.contrib.plugins.form_elements.fields.slider`
|
||||
conf module, falling back to the default.
|
||||
|
||||
If override is not None, it will be used instead of the setting.
|
||||
|
||||
:param setting: String with setting name.
|
||||
:param override: Value to use when no setting is available. Defaults
|
||||
to None.
|
||||
:return: Setting value.
|
||||
"""
|
||||
if override is not None:
|
||||
return override
|
||||
if hasattr(settings,
|
||||
'FOBI_FORM_ELEMENT_SLIDER_{0}'.format(setting)):
|
||||
return getattr(
|
||||
settings,
|
||||
'FOBI_FORM_ELEMENT_SLIDER_{0}'.format(setting)
|
||||
)
|
||||
else:
|
||||
return getattr(defaults, setting)
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
__title__ = 'fobi.contrib.plugins.form_elements.fields.' \
|
||||
'slider.defaults'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
__copyright__ = '2014-2016 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = (
|
||||
'INITIAL',
|
||||
'MAX_VALUE',
|
||||
'MIN_VALUE',
|
||||
'STEP',
|
||||
)
|
||||
|
||||
INITIAL = 50
|
||||
MIN_VALUE = 0
|
||||
MAX_VALUE = 100
|
||||
STEP = 1
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
from django.forms.fields import ChoiceField
|
||||
from django.forms.widgets import TextInput, Select
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from fobi.base import FormFieldPlugin, form_element_plugin_registry, get_theme
|
||||
|
||||
from . import UID
|
||||
from .forms import SliderInputForm
|
||||
from .settings import INITIAL, MAX_VALUE, MIN_VALUE, STEP
|
||||
|
||||
__title__ = 'fobi.contrib.plugins.form_elements.fields.' \
|
||||
'slider_percentage.fobi_form_elements'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
__copyright__ = '2014-2016 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = ('SliderInputPlugin',)
|
||||
|
||||
theme = get_theme(request=None, as_instance=True)
|
||||
|
||||
|
||||
class SliderInputPlugin(FormFieldPlugin):
|
||||
"""Slider field plugin."""
|
||||
|
||||
uid = UID
|
||||
name = _("Slider")
|
||||
group = _("Fields")
|
||||
form = SliderInputForm
|
||||
html_classes = ['slider']
|
||||
|
||||
def get_form_field_instances(self, request=None):
|
||||
"""Get form field instances."""
|
||||
initial = self.data.initial if self.data.initial else INITIAL
|
||||
max_value = self.data.max_value if self.data.max_value else MAX_VALUE
|
||||
min_value = self.data.min_value if self.data.min_value else MIN_VALUE
|
||||
step = self.data.step if self.data.step else STEP
|
||||
|
||||
_choices = range(min_value, max_value, step)
|
||||
choices = zip(_choices, _choices)
|
||||
|
||||
kwargs = {
|
||||
'label': self.data.label,
|
||||
'help_text': self.data.help_text,
|
||||
'initial': initial,
|
||||
'required': self.data.required,
|
||||
'choices': choices,
|
||||
'widget': Select(
|
||||
attrs={
|
||||
'class': "slider {0}".format(
|
||||
theme.form_element_html_class
|
||||
),
|
||||
'data-slider-min': min_value,
|
||||
'data-slider-max': max_value,
|
||||
'data-slider-step': step,
|
||||
'data-slider-value': initial,
|
||||
}
|
||||
),
|
||||
}
|
||||
|
||||
return [(self.data.name, ChoiceField, kwargs)]
|
||||
|
||||
|
||||
form_element_plugin_registry.register(SliderInputPlugin)
|
||||
129
src/fobi/contrib/plugins/form_elements/fields/slider/forms.py
Normal file
129
src/fobi/contrib/plugins/form_elements/fields/slider/forms.py
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
from django import forms
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from fobi.base import BaseFormFieldPluginForm, get_theme
|
||||
|
||||
from .settings import INITIAL, MAX_VALUE, MIN_VALUE, STEP
|
||||
|
||||
__title__ = 'fobi.contrib.plugins.form_elements.fields.slider.forms'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
__copyright__ = '2014-2015 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = ('SliderInputForm',)
|
||||
|
||||
theme = get_theme(request=None, as_instance=True)
|
||||
|
||||
|
||||
class SliderInputForm(forms.Form, BaseFormFieldPluginForm):
|
||||
"""Form for ``SliderPercentageInputPlugin``."""
|
||||
|
||||
plugin_data_fields = [
|
||||
("label", ""),
|
||||
("name", ""),
|
||||
("min_value", MIN_VALUE),
|
||||
("max_value", MAX_VALUE),
|
||||
("step", STEP),
|
||||
("help_text", ""),
|
||||
("initial", INITIAL),
|
||||
("required", False)
|
||||
]
|
||||
|
||||
label = forms.CharField(
|
||||
label=_("Label"),
|
||||
required=True,
|
||||
widget=forms.widgets.TextInput(
|
||||
attrs={'class': theme.form_element_html_class}
|
||||
)
|
||||
)
|
||||
name = forms.CharField(
|
||||
label=_("Name"),
|
||||
required=True,
|
||||
widget=forms.widgets.TextInput(
|
||||
attrs={'class': theme.form_element_html_class}
|
||||
)
|
||||
)
|
||||
min_value = forms.IntegerField(
|
||||
label=_("Min value"),
|
||||
required=True,
|
||||
widget=forms.widgets.TextInput(
|
||||
attrs={'class': theme.form_element_html_class}
|
||||
),
|
||||
min_value=MIN_VALUE,
|
||||
max_value=MAX_VALUE
|
||||
)
|
||||
max_value = forms.IntegerField(
|
||||
label=_("Max value"),
|
||||
required=True,
|
||||
widget=forms.widgets.TextInput(
|
||||
attrs={'class': theme.form_element_html_class}
|
||||
),
|
||||
min_value=MIN_VALUE,
|
||||
max_value=MAX_VALUE
|
||||
)
|
||||
step = forms.IntegerField(
|
||||
label=_("Step"),
|
||||
required=True,
|
||||
help_text=_("Step size"),
|
||||
widget=forms.widgets.TextInput(
|
||||
attrs={'class': theme.form_element_html_class}
|
||||
),
|
||||
min_value=MIN_VALUE,
|
||||
max_value=MAX_VALUE
|
||||
)
|
||||
help_text = forms.CharField(
|
||||
label=_("Help text"),
|
||||
required=False,
|
||||
widget=forms.widgets.TextInput(
|
||||
attrs={'class': theme.form_element_html_class}
|
||||
)
|
||||
)
|
||||
initial = forms.IntegerField(
|
||||
label=_("Initial"),
|
||||
required=False,
|
||||
widget=forms.widgets.TextInput(
|
||||
attrs={'class': theme.form_element_html_class}
|
||||
),
|
||||
min_value=MIN_VALUE,
|
||||
max_value=MAX_VALUE,
|
||||
initial=INITIAL
|
||||
)
|
||||
required = forms.BooleanField(
|
||||
label=_("Required"),
|
||||
required=False,
|
||||
widget=forms.widgets.CheckboxInput(
|
||||
attrs={'class': theme.form_element_checkbox_html_class}
|
||||
)
|
||||
)
|
||||
|
||||
def clean(self):
|
||||
"""Validating the values."""
|
||||
super(SliderInputForm, self).clean()
|
||||
|
||||
max_value = self.cleaned_data['max_value']
|
||||
min_value = self.cleaned_data['min_value']
|
||||
initial = self.cleaned_data['initial']
|
||||
step = self.cleaned_data['step']
|
||||
|
||||
if max_value < min_value:
|
||||
self.add_error(
|
||||
'max_value',
|
||||
_("`max_value` should be > than `min_value`.")
|
||||
)
|
||||
|
||||
if step > max_value - min_value:
|
||||
self.add_error(
|
||||
'step',
|
||||
_("`step` should be > than `max_value` - `min_value`.")
|
||||
)
|
||||
|
||||
if max_value < initial:
|
||||
self.add_error(
|
||||
'initial',
|
||||
_("`max_value` should be >= than `initial`.")
|
||||
)
|
||||
|
||||
if min_value > initial:
|
||||
self.add_error(
|
||||
'min_value',
|
||||
_("`initial` should be >= than `min_value`.")
|
||||
)
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
from .conf import get_setting
|
||||
|
||||
__title__ = 'fobi.contrib.plugins.form_elements.fields.' \
|
||||
'slider.settings'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
__copyright__ = '2014-2016 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = (
|
||||
'INITIAL',
|
||||
'MAX_VALUE',
|
||||
'MIN_VALUE',
|
||||
'STEP',
|
||||
)
|
||||
|
||||
INITIAL = get_setting('INITIAL')
|
||||
|
||||
MAX_VALUE = get_setting('MAX_VALUE')
|
||||
|
||||
MIN_VALUE = get_setting('MIN_VALUE')
|
||||
|
||||
STEP = get_setting('STEP')
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
from __future__ import absolute_import
|
||||
|
||||
from fobi.base import FormElementPluginWidget
|
||||
|
||||
from . import UID
|
||||
|
||||
__title__ = 'fobi.contrib.plugins.form_elements.fields.slider.' \
|
||||
'widgets'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
__copyright__ = '2014-2016 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = ('BaseSliderPluginWidget',)
|
||||
|
||||
|
||||
class BaseSliderPluginWidget(FormElementPluginWidget):
|
||||
"""Base date form element plugin widget."""
|
||||
|
||||
plugin_uid = UID
|
||||
html_classes = ['slider']
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
===============================================
|
||||
==============================================
|
||||
fobi.contrib.plugins.form_elements.fields.slug
|
||||
===============================================
|
||||
==============================================
|
||||
A ``Fobi`` Text form field plugin. Makes use of the
|
||||
``django.forms.fields.SlugField`` and ``django.forms.widgets.TextInput``.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.slug`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
===============================================
|
||||
==============================================
|
||||
fobi.contrib.plugins.form_elements.fields.text
|
||||
===============================================
|
||||
==============================================
|
||||
A ``Fobi`` Text form field plugin. Makes use of the
|
||||
``django.forms.fields.CharField`` and ``django.forms.widgets.TextInput``.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.text`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ A ``Fobi`` Textarea form field plugin. Makes use of the
|
|||
``django.forms.fields.CharField`` and ``django.forms.widgets.Textarea``.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.textarea`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
===============================================
|
||||
==============================================
|
||||
fobi.contrib.plugins.form_elements.fields.time
|
||||
===============================================
|
||||
==============================================
|
||||
A ``Fobi`` DateTime form field plugin. Makes use of the
|
||||
``django.forms.fields.TimeField`` and
|
||||
``django.forms.widgets.TextInput``.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.time`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
===============================================
|
||||
=============================================
|
||||
fobi.contrib.plugins.form_elements.fields.url
|
||||
===============================================
|
||||
=============================================
|
||||
A ``Fobi`` URL form field plugin. Makes use of the
|
||||
``django.forms.fields.URLField`` and ``django.forms.widgets.URLInput`` falling
|
||||
back to ``django.forms.widgets.TextInput`` for older Django versions.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.fields.url`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ Install `fobi` Captcha plugin
|
|||
|
||||
Troubleshooting and usage limitations
|
||||
=====================================
|
||||
In combination with other captcha solutions
|
||||
-------------------------------------------
|
||||
At the moment, you can't use both ``CAPTCHA``
|
||||
(fobi.contrib.plugins.form_elements.security.captcha) and ``ReCAPTCHA``
|
||||
(fobi.contrib.plugins.form_elements.security.recaptcha) plugins alongside due
|
||||
|
|
@ -64,6 +66,12 @@ packages. That limitation is likely to be solved in future in the
|
|||
``django-recaptcha`` package. Until then, you should choose either one or
|
||||
another, but not both on the same time.
|
||||
|
||||
In form wizards
|
||||
---------------
|
||||
At the moment, captcha fields do not work in form wizards, as they are
|
||||
invalidated on the last step, which breaks the cycle. Therefore, it's not
|
||||
recommended to use captcha plugins in form wizards.
|
||||
|
||||
Usage
|
||||
=====
|
||||
Note, that unlike most of the other form element plugins, default
|
||||
|
|
|
|||
|
|
@ -25,6 +25,3 @@ Installation
|
|||
|
||||
3. Assign appropriate permissions to the target users/groups to be using
|
||||
the plugin if ``FOBI_RESTRICT_PLUGIN_ACCESS`` is set to True.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ Install `fobi` ReCAPTCHA plugin
|
|||
|
||||
Troubleshooting and usage limitations
|
||||
=====================================
|
||||
In combination with other captcha solutions
|
||||
-------------------------------------------
|
||||
At the moment, you can't use both ``CAPTCHA``
|
||||
(fobi.contrib.plugins.form_elements.security.captcha) and ``ReCAPTCHA``
|
||||
(fobi.contrib.plugins.form_elements.security.recaptcha) plugins alongside due
|
||||
|
|
@ -64,6 +66,12 @@ invalid", make sure to have defined (and filled in properly) the
|
|||
See the `following <https://github.com/praekelt/django-recaptcha/issues/32>`_
|
||||
thread for more information.
|
||||
|
||||
In form wizards
|
||||
---------------
|
||||
At the moment, captcha fields do not work in form wizards, as they are
|
||||
invalidated on the last step, which breaks the cycle. Therefore, it's not
|
||||
recommended to use captcha plugins in form wizards.
|
||||
|
||||
Usage
|
||||
=====
|
||||
Note, that unlike most of the other form element plugins, default
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
=================================================
|
||||
=============================================
|
||||
fobi.contrib.plugins.form_elements.test.dummy
|
||||
=================================================
|
||||
=============================================
|
||||
A ``Fobi`` Dummy form element plugin. Created for testing purposes.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.plugins.form_elements.test.dummy`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -53,9 +53,9 @@ def view_saved_form_data_entries(
|
|||
:param string template_name:
|
||||
:return django.http.HttpResponse:
|
||||
"""
|
||||
entries = SavedFormDataEntry._default_manager \
|
||||
.filter(user__pk=request.user.pk) \
|
||||
.select_related('form_entry')
|
||||
entries = SavedFormDataEntry._default_manager\
|
||||
.select_related('form_entry') \
|
||||
.filter(form_entry__user__pk=request.user.pk)
|
||||
|
||||
if form_entry_id:
|
||||
entries = entries.filter(form_entry__id=form_entry_id)
|
||||
|
|
@ -92,8 +92,8 @@ def export_saved_form_data_entries(request, form_entry_id=None, theme=None):
|
|||
:return django.http.HttpResponse:
|
||||
"""
|
||||
entries = SavedFormDataEntry._default_manager \
|
||||
.filter(user__pk=request.user.pk)
|
||||
# entries = entries.select_related('form_entry')
|
||||
.select_related('form_entry') \
|
||||
.filter(form_entry__user__pk=request.user.pk)
|
||||
|
||||
if form_entry_id:
|
||||
entries = entries.filter(form_entry__id=form_entry_id)
|
||||
|
|
@ -120,8 +120,8 @@ def view_saved_form_wizard_data_entries(
|
|||
:return django.http.HttpResponse:
|
||||
"""
|
||||
entries = SavedFormWizardDataEntry._default_manager \
|
||||
.filter(user__pk=request.user.pk) \
|
||||
.select_related('form_wizard_entry')
|
||||
.select_related('form_wizard_entry') \
|
||||
.filter(form_wizard_entry__user__pk=request.user.pk)
|
||||
|
||||
if form_wizard_entry_id:
|
||||
entries = entries.filter(form_wizard_entry__id=form_wizard_entry_id)
|
||||
|
|
@ -164,8 +164,8 @@ def export_saved_form_wizard_data_entries(request,
|
|||
:return django.http.HttpResponse:
|
||||
"""
|
||||
entries = SavedFormWizardDataEntry._default_manager \
|
||||
.filter(user__pk=request.user.pk)
|
||||
# entries = entries.select_related('form_entry')
|
||||
.select_related('form_wizard_entry') \
|
||||
.filter(form_wizard_entry__user__pk=request.user.pk)
|
||||
|
||||
if form_wizard_entry_id:
|
||||
entries = entries.filter(form_wizard_entry__id=form_wizard_entry_id)
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ in the `Account API <https://us5.admin.mailchimp.com/account/api/>`_.
|
|||
For additional information on MailChimp import see the following `article
|
||||
<http://kb.mailchimp.com/lists/managing-subscribers/manage-list-and-signup-form-fields>`_.
|
||||
|
||||
Rerequiresites
|
||||
==============
|
||||
Prerequisites
|
||||
=============
|
||||
Python wrapper for the Mailchimp:
|
||||
|
||||
.. code-block:: sh
|
||||
|
|
@ -44,7 +44,7 @@ your_project/settings.py
|
|||
How it works
|
||||
============
|
||||
Assuming that you have configured the `mailchimp_importer` plugin properly and
|
||||
have the Django runnig locally on port 8000, accessing the following URL would
|
||||
have the Django running locally on port 8000, accessing the following URL would
|
||||
bring you to the MailChimp form import wizard.
|
||||
|
||||
- http://localhost:8000/en/fobi/forms/importer/mailchimp/
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
===============================================
|
||||
==============================
|
||||
fobi.contrib.themes.bootstrap3
|
||||
===============================================
|
||||
==============================
|
||||
A ``django-fobi`` Bootstrap 3 theme. Based on the ??? template.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.themes.bootstrap3`` to the
|
||||
``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
===============================================================================
|
||||
===========================================================================
|
||||
fobi.contrib.themes.bootstrap3.widgets.form_elements.date_bootstrap3_widget
|
||||
===============================================================================
|
||||
===========================================================================
|
||||
A fancy date picker widget to the ``date`` plugin (for Bootstrap 3
|
||||
theme).
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.themes.bootstrap3.widgets.form_elements.date_bootstrap3_widget``
|
||||
to the ``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ A fancy datetime picker widget to the ``datetime`` plugin (for Bootstrap 3
|
|||
theme).
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.themes.bootstrap3.widgets.form_elements.datetime_bootstrap3_widget``
|
||||
to the ``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
============================================================================
|
||||
fobi.contrib.themes.bootstrap3.widgets.form_elements.dummy_bootstrap3_widget
|
||||
============================================================================
|
||||
A dummy widget to the ``dummy`` plugin (for Bootstrap 3 theme).
|
||||
|
||||
Installation
|
||||
============
|
||||
1. Add ``fobi.contrib.themes.bootstrap3.widgets.form_elements.dummy_bootstrap3_widget``
|
||||
to the ``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
INSTALLED_APPS = (
|
||||
# ...
|
||||
'fobi.contrib.themes.bootstrap3',
|
||||
'fobi.contrib.themes.bootstrap3.widgets.form_elements.dummy_bootstrap3_widget',
|
||||
'fobi.contrib.plugins.form_elements.test.dummy',
|
||||
# ...
|
||||
)
|
||||
|
||||
2. Specify ``bootstrap3`` as a default theme in your ``settings.py``:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
FOBI_DEFAULT_THEME = 'bootstrap3'
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
=============================================================================
|
||||
fobi.contrib.themes.bootstrap3.widgets.form_elements.slider_bootstrap3_widget
|
||||
=============================================================================
|
||||
A fancy slider widget to the ``slider`` plugin (for Bootstrap 3 theme).
|
||||
|
||||
Installation
|
||||
============
|
||||
1. Add ``fobi.contrib.themes.bootstrap3.widgets.form_elements.slider_bootstrap3_widget``
|
||||
to the ``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
INSTALLED_APPS = (
|
||||
# ...
|
||||
'fobi.contrib.themes.bootstrap3',
|
||||
'fobi.contrib.themes.bootstrap3.widgets.form_elements.slider_bootstrap3_widget',
|
||||
'fobi.contrib.plugins.form_elements.fields.slider',
|
||||
# ...
|
||||
)
|
||||
|
||||
2. Specify ``bootstrap3`` as a default theme in your ``settings.py``:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
FOBI_DEFAULT_THEME = 'bootstrap3'
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
__title__ = 'fobi.contrib.themes.bootstrap3.widgets.form_elements.' \
|
||||
'slider_bootstrap3_widget'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
__copyright__ = '2014-2016 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = ('default_app_config',)
|
||||
|
||||
default_app_config = 'fobi.contrib.themes.bootstrap3.widgets.form_elements.' \
|
||||
'slider_bootstrap3_widget.apps.Config'
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
__title__ = 'fobi.contrib.themes.bootstrap3.widgets.form_elements.' \
|
||||
'slider_bootstrap3_widget.apps'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
__copyright__ = '2014-2016 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = ('Config',)
|
||||
|
||||
try:
|
||||
from django.apps import AppConfig
|
||||
|
||||
class Config(AppConfig):
|
||||
"""Config."""
|
||||
|
||||
name = 'fobi.contrib.themes.bootstrap3.widgets.form_elements.' \
|
||||
'slider_bootstrap3_widget'
|
||||
label = 'fobi_contrib_themes_bootstrap3_widgets_form_elements_' \
|
||||
'slider_bootstrap3_widget'
|
||||
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
from fobi.base import form_element_plugin_widget_registry
|
||||
from fobi.contrib.plugins.form_elements.fields.slider.widgets import (
|
||||
BaseSliderPluginWidget
|
||||
)
|
||||
from fobi.contrib.themes.bootstrap3 import UID
|
||||
|
||||
__title__ = 'fobi.contrib.themes.bootstrap3.widgets.form_elements.' \
|
||||
'slider_percentage_bootstrap3_widget.fobi_form_elements'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
__copyright__ = '2014-2016 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = ('SliderPluginWidget',)
|
||||
|
||||
|
||||
class SliderPluginWidget(BaseSliderPluginWidget):
|
||||
"""Slider plugin widget for Bootstrap 3."""
|
||||
|
||||
theme_uid = UID
|
||||
media_js = [
|
||||
'bootstrap3/js/bootstrap-slider.min.js',
|
||||
'bootstrap3/js/fobi.plugin.slider-bootstrap3-widget.js',
|
||||
]
|
||||
media_css = [
|
||||
'bootstrap3/css/bootstrap-slider.min.css',
|
||||
'bootstrap3/css/fobi.plugin.slider-bootstrap3-widget.css',
|
||||
]
|
||||
|
||||
|
||||
# Registering the widget
|
||||
form_element_plugin_widget_registry.register(SliderPluginWidget)
|
||||
|
|
@ -0,0 +1,264 @@
|
|||
/*! =======================================================
|
||||
VERSION 9.2.2
|
||||
========================================================= */
|
||||
/*! =========================================================
|
||||
* bootstrap-slider.js
|
||||
*
|
||||
* Maintainers:
|
||||
* Kyle Kemp
|
||||
* - Twitter: @seiyria
|
||||
* - Github: seiyria
|
||||
* Rohit Kalkur
|
||||
* - Twitter: @Rovolutionary
|
||||
* - Github: rovolution
|
||||
*
|
||||
* =========================================================
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ========================================================= */
|
||||
.slider {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
position: relative;
|
||||
}
|
||||
.slider.slider-horizontal {
|
||||
width: 210px;
|
||||
height: 20px;
|
||||
}
|
||||
.slider.slider-horizontal .slider-track {
|
||||
height: 10px;
|
||||
width: 100%;
|
||||
margin-top: -5px;
|
||||
top: 50%;
|
||||
left: 0;
|
||||
}
|
||||
.slider.slider-horizontal .slider-selection,
|
||||
.slider.slider-horizontal .slider-track-low,
|
||||
.slider.slider-horizontal .slider-track-high {
|
||||
height: 100%;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
.slider.slider-horizontal .slider-tick,
|
||||
.slider.slider-horizontal .slider-handle {
|
||||
margin-left: -10px;
|
||||
}
|
||||
.slider.slider-horizontal .slider-tick.triangle,
|
||||
.slider.slider-horizontal .slider-handle.triangle {
|
||||
position: relative;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
border-width: 0 10px 10px 10px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-bottom-color: #0480be;
|
||||
margin-top: 0;
|
||||
}
|
||||
.slider.slider-horizontal .slider-tick-container {
|
||||
white-space: nowrap;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
}
|
||||
.slider.slider-horizontal .slider-tick-label-container {
|
||||
white-space: nowrap;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.slider.slider-horizontal .slider-tick-label-container .slider-tick-label {
|
||||
padding-top: 4px;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
}
|
||||
.slider.slider-vertical {
|
||||
height: 210px;
|
||||
width: 20px;
|
||||
}
|
||||
.slider.slider-vertical .slider-track {
|
||||
width: 10px;
|
||||
height: 100%;
|
||||
left: 25%;
|
||||
top: 0;
|
||||
}
|
||||
.slider.slider-vertical .slider-selection {
|
||||
width: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
.slider.slider-vertical .slider-track-low,
|
||||
.slider.slider-vertical .slider-track-high {
|
||||
width: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
.slider.slider-vertical .slider-tick,
|
||||
.slider.slider-vertical .slider-handle {
|
||||
margin-top: -10px;
|
||||
}
|
||||
.slider.slider-vertical .slider-tick.triangle,
|
||||
.slider.slider-vertical .slider-handle.triangle {
|
||||
border-width: 10px 0 10px 10px;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
border-left-color: #0480be;
|
||||
margin-left: 0;
|
||||
}
|
||||
.slider.slider-vertical .slider-tick-label-container {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.slider.slider-vertical .slider-tick-label-container .slider-tick-label {
|
||||
padding-left: 4px;
|
||||
}
|
||||
.slider.slider-disabled .slider-handle {
|
||||
background-image: -webkit-linear-gradient(top, #dfdfdf 0%, #bebebe 100%);
|
||||
background-image: -o-linear-gradient(top, #dfdfdf 0%, #bebebe 100%);
|
||||
background-image: linear-gradient(to bottom, #dfdfdf 0%, #bebebe 100%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdfdfdf', endColorstr='#ffbebebe', GradientType=0);
|
||||
}
|
||||
.slider.slider-disabled .slider-track {
|
||||
background-image: -webkit-linear-gradient(top, #e5e5e5 0%, #e9e9e9 100%);
|
||||
background-image: -o-linear-gradient(top, #e5e5e5 0%, #e9e9e9 100%);
|
||||
background-image: linear-gradient(to bottom, #e5e5e5 0%, #e9e9e9 100%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe5e5e5', endColorstr='#ffe9e9e9', GradientType=0);
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.slider input {
|
||||
display: none;
|
||||
}
|
||||
.slider .tooltip.top {
|
||||
margin-top: -36px;
|
||||
}
|
||||
.slider .tooltip-inner {
|
||||
white-space: nowrap;
|
||||
max-width: none;
|
||||
}
|
||||
.slider .hide {
|
||||
display: none;
|
||||
}
|
||||
.slider-track {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #f9f9f9 100%);
|
||||
background-image: -o-linear-gradient(top, #f5f5f5 0%, #f9f9f9 100%);
|
||||
background-image: linear-gradient(to bottom, #f5f5f5 0%, #f9f9f9 100%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#fff9f9f9', GradientType=0);
|
||||
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||
border-radius: 4px;
|
||||
}
|
||||
.slider-selection {
|
||||
position: absolute;
|
||||
background-image: -webkit-linear-gradient(top, #f9f9f9 0%, #f5f5f5 100%);
|
||||
background-image: -o-linear-gradient(top, #f9f9f9 0%, #f5f5f5 100%);
|
||||
background-image: linear-gradient(to bottom, #f9f9f9 0%, #f5f5f5 100%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9f9f9', endColorstr='#fff5f5f5', GradientType=0);
|
||||
-webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
|
||||
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.slider-selection.tick-slider-selection {
|
||||
background-image: -webkit-linear-gradient(top, #89cdef 0%, #81bfde 100%);
|
||||
background-image: -o-linear-gradient(top, #89cdef 0%, #81bfde 100%);
|
||||
background-image: linear-gradient(to bottom, #89cdef 0%, #81bfde 100%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff89cdef', endColorstr='#ff81bfde', GradientType=0);
|
||||
}
|
||||
.slider-track-low,
|
||||
.slider-track-high {
|
||||
position: absolute;
|
||||
background: transparent;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.slider-handle {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
background-color: #337ab7;
|
||||
background-image: -webkit-linear-gradient(top, #149bdf 0%, #0480be 100%);
|
||||
background-image: -o-linear-gradient(top, #149bdf 0%, #0480be 100%);
|
||||
background-image: linear-gradient(to bottom, #149bdf 0%, #0480be 100%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff149bdf', endColorstr='#ff0480be', GradientType=0);
|
||||
filter: none;
|
||||
-webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
|
||||
box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
|
||||
border: 0px solid transparent;
|
||||
}
|
||||
.slider-handle.round {
|
||||
border-radius: 50%;
|
||||
}
|
||||
.slider-handle.triangle {
|
||||
background: transparent none;
|
||||
}
|
||||
.slider-handle.custom {
|
||||
background: transparent none;
|
||||
}
|
||||
.slider-handle.custom::before {
|
||||
line-height: 20px;
|
||||
font-size: 20px;
|
||||
content: '\2605';
|
||||
color: #726204;
|
||||
}
|
||||
.slider-tick {
|
||||
position: absolute;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
background-image: -webkit-linear-gradient(top, #f9f9f9 0%, #f5f5f5 100%);
|
||||
background-image: -o-linear-gradient(top, #f9f9f9 0%, #f5f5f5 100%);
|
||||
background-image: linear-gradient(to bottom, #f9f9f9 0%, #f5f5f5 100%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9f9f9', endColorstr='#fff5f5f5', GradientType=0);
|
||||
-webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
|
||||
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
filter: none;
|
||||
opacity: 0.8;
|
||||
border: 0px solid transparent;
|
||||
}
|
||||
.slider-tick.round {
|
||||
border-radius: 50%;
|
||||
}
|
||||
.slider-tick.triangle {
|
||||
background: transparent none;
|
||||
}
|
||||
.slider-tick.custom {
|
||||
background: transparent none;
|
||||
}
|
||||
.slider-tick.custom::before {
|
||||
line-height: 20px;
|
||||
font-size: 20px;
|
||||
content: '\2605';
|
||||
color: #726204;
|
||||
}
|
||||
.slider-tick.in-selection {
|
||||
background-image: -webkit-linear-gradient(top, #89cdef 0%, #81bfde 100%);
|
||||
background-image: -o-linear-gradient(top, #89cdef 0%, #81bfde 100%);
|
||||
background-image: linear-gradient(to bottom, #89cdef 0%, #81bfde 100%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff89cdef', endColorstr='#ff81bfde', GradientType=0);
|
||||
opacity: 1;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,3 @@
|
|||
.slider .slider-selection {
|
||||
background: #BABABA;
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
Document : fobi.plugin.slider-bootstrap3-widget.js
|
||||
Created on : Oct 19, 2016, 03:30:35 AM
|
||||
Author : Artur Barseghyan (artur.barseghyan@gmail.com)
|
||||
Description:
|
||||
`bootstrap3` theme slider plugin scripts.
|
||||
*/
|
||||
;
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.slider').bootstrapSlider();
|
||||
});
|
||||
|
|
@ -7,9 +7,9 @@ Relies on ``djangocms-admin-style`` package and some jQuery UI only.
|
|||
jQuery UI "Smoothness" theme comes from `here <http://jqueryui.com/>`_.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
Install `djangocms-admin-style`
|
||||
-----------------------------------------------
|
||||
-------------------------------
|
||||
See the original `installation instructions
|
||||
<https://pypi.python.org/pypi/djangocms-admin-style#installation>`_.
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,9 @@
|
|||
fobi.contrib.themes.djangocms_admin_style_theme.widgets.form_handlers.db_store
|
||||
==============================================================================
|
||||
A ``db_store`` form handler plugin widget for Simple theme.
|
||||
was used.
|
||||
|
||||
Installation
|
||||
===============================================
|
||||
============
|
||||
1. Add ``fobi.contrib.themes.djangocms_admin_style_theme.widgets.form_handlers.db_store``
|
||||
to the ``INSTALLED_APPS`` in your ``settings.py``.
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue