Permalink
Browse files

renamed settings to app_settings for consistancy

removed collectionversion model because that was app specific
starting to update docs
  • Loading branch information...
1 parent 34224a3 commit 27d5e38156bb183e759f6ea8ff05a0f39882f23f @jmacul2 jmacul2 committed Nov 18, 2011
Showing with 1,460 additions and 846 deletions.
  1. +1 −1 dataforms/__init__.py
  2. +3 −4 dataforms/admin/__init__.py
  3. +1 −1 dataforms/admin/bindingadmin.py
  4. +1 −1 dataforms/admin/choiceadmin.py
  5. +1 −6 dataforms/admin/collectionadmin.py
  6. +1 −1 dataforms/admin/dataformadmin.py
  7. +1 −1 dataforms/admin/fieldadmin.py
  8. +2 −23 dataforms/{settings.py → app_settings.py}
  9. +4 −18 dataforms/forms.py
  10. +1 −14 dataforms/models.py
  11. +1 −1 dataforms/test_helpers.py
  12. +1 −1 dataforms/utils/file.py
  13. +1 −1 dataforms/views.py
  14. +1 −1 docs/build/html/.buildinfo
  15. +1 −1 docs/build/html/_sources/forms.txt
  16. +92 −7 docs/build/html/_sources/index.txt
  17. +130 −7 docs/build/html/_static/basic.css
  18. +54 −8 docs/build/html/_static/default.css
  19. +33 −18 docs/build/html/_static/doctools.js
  20. +151 −29 docs/build/html/_static/jquery.js
  21. +62 −61 docs/build/html/_static/pygments.css
  22. +84 −33 docs/build/html/_static/searchtools.js
  23. +140 −107 docs/build/html/forms.html
  24. +211 −217 docs/build/html/genindex.html
  25. +128 −46 docs/build/html/index.html
  26. +62 −198 docs/build/html/models.html
  27. BIN docs/build/html/objects.inv
  28. +15 −10 docs/build/html/search.html
  29. +1 −1 docs/build/html/searchindex.js
  30. +44 −0 docs/source/concepts.rst
  31. +4 −4 docs/source/conf.py
  32. BIN docs/source/dataforms_models.png
  33. +4 −0 docs/source/diagram.rst
  34. +1 −1 docs/source/{forms.txt → forms.rst}
  35. +106 −0 docs/source/index.rst
  36. +0 −21 docs/source/index.txt
  37. 0 docs/source/{models.txt → models.rst}
  38. +80 −0 docs/source/settings.rst
  39. +34 −0 docs/source/validation.rst
  40. +3 −3 example/validation.py
@@ -1,2 +1,2 @@
-VERSION = (0, 1, 1)
+VERSION = (0, 3, 0)
__version__ = '.'.join(map(str, VERSION))
@@ -2,13 +2,13 @@
from bindingadmin import BindingAdmin
from choiceadmin import ChoiceAdmin, ChoiceMappingAdmin
from collectionadmin import SectionAdmin, CollectionAdmin, \
- CollectionMappingAdmin, CollectionVersionAdmin
+ CollectionMappingAdmin
from dataformadmin import DataFormAdmin
from fieldadmin import FieldMappingAdmin, FieldAdmin
-from dataforms.models import Collection, CollectionDataForm, CollectionVersion, \
+from dataforms.models import Collection, CollectionDataForm, \
DataForm, DataFormField, Field, Binding, FieldChoice, Choice, Answer, Submission, \
Section, AnswerChoice
-from dataforms.settings import ADMIN_JS
+from dataforms.app_settings import ADMIN_JS
from django.conf.urls.defaults import patterns
from django.contrib import admin
from django.forms.models import ModelChoiceField
@@ -19,7 +19,6 @@
admin.site.register(Section, SectionAdmin)
admin.site.register(Collection, CollectionAdmin)
admin.site.register(CollectionDataForm, CollectionMappingAdmin)
-admin.site.register(CollectionVersion, CollectionVersionAdmin)
admin.site.register(DataForm, DataFormAdmin)
admin.site.register(DataFormField, FieldMappingAdmin)
admin.site.register(Field, FieldAdmin)
@@ -1,5 +1,5 @@
from dataforms.admin.forms import BindingAdminForm
-from dataforms.settings import ADMIN_JS
+from dataforms.app_settings import ADMIN_JS
from django.conf.urls.defaults import patterns
from django.contrib import admin
from django.contrib.contenttypes.models import ContentType
@@ -1,4 +1,4 @@
-from dataforms.settings import ADMIN_JS
+from dataforms.app_settings import ADMIN_JS
from django.contrib import admin
@@ -1,4 +1,4 @@
-from dataforms.settings import ADMIN_JS
+from dataforms.app_settings import ADMIN_JS
from django.contrib import admin
from inlines import CollectionInline
@@ -21,11 +21,6 @@ class Media:
js = ADMIN_JS
-class CollectionVersionAdmin(admin.ModelAdmin):
- list_display = ('slug', 'collection', 'last_modified' )
- save_as = True
-
-
class CollectionMappingAdmin(admin.ModelAdmin):
list_display = ('collection', 'data_form', 'section', 'order',)
list_filter = ('collection__title', 'section__title',)
@@ -1,4 +1,4 @@
-from dataforms.settings import ADMIN_JS
+from dataforms.app_settings import ADMIN_JS
from django.contrib import admin
from inlines import CollectionInline, FieldInline
@@ -1,6 +1,6 @@
from dataforms.admin.forms import FieldAdminForm
from dataforms.models import Field, DataForm
-from dataforms.settings import ADMIN_JS
+from dataforms.app_settings import ADMIN_JS
from django import forms
from django.contrib import admin
from inlines import ChoiceInline, FieldInline
@@ -1,24 +1,5 @@
"""
-App Settings
-============
-
-This file should not be updated. Instead, please put any additional field mappings
-in your project settings file. That way any custom fields and widgets will be
-de-coupled from this app.
-
-:constant FIELD_MAPPINGS: a dictionary of form fields are available to be used.
-:constant ADMIN_SORT_JS: tuple that references the custom javascript for the django admin.
-:constant FIELD_TYPE_CHOICES: tuple that is used by the model as choices
-
-:constant BOOLEAN_FIELDS: an element of FIELD_MAPPINGS that should be interpreted
- on save as only yes/no
-:constant SINGLE_CHOICE_FIELDS = field types that have choices, but only one selected
- on save, for Select boxes or a single RadioSelect type
-:constant MULTI_CHOICE_FIELDS = field types that have choices and multiple
- ones can be selected on save, for SelectMultiple boxes or CheckboxSelectMultiple
-:constant CHOICE_FIELDS: both SINGLE_CHOICE_FIELDS and MULTI_CHOICE_FIELDS
-:constant SINGLE_NUMBER_FIELDS: For fields that need pseudo-foreign key storage
-:constant MULTI_NUMBER_FIELDS: For fields that need pseudo-many-to-many storage
+Dataforms App Settings
"""
from django.conf import settings
@@ -47,8 +28,6 @@
# Note Widget: This is a way you can add sub headings to your forms. See - dataforms.widgets.NoteWidget
'Note' : { 'class': 'django.forms.CharField', 'widget': 'dataforms.widgets.NoteWidget' },
-
-
# FIXME: Remove After testing....
'USStateField' : { 'class': 'django.contrib.localflavor.us.forms.USStateField', 'widget' : 'django.forms.TextInput' },
} )
@@ -63,7 +42,7 @@
SINGLE_CHOICE_FIELDS = getattr(settings, "DATAFORMS_SINGLE_CHOICE_FIELDS", ()) + ('Select', 'RadioSelect')
MULTI_CHOICE_FIELDS = getattr(settings, "DATAFORMS_MULTI_CHOICE_FIELDS", ()) + ('SelectMultiple', 'CheckboxSelectMultiple')
# These fields tie into the Choice Model
-CHOICE_FIELDS = getattr(settings, "DATAFORMS_CHOICE_FIELDS", ()) + (SINGLE_CHOICE_FIELDS + MULTI_CHOICE_FIELDS)
+CHOICE_FIELDS = (SINGLE_CHOICE_FIELDS + MULTI_CHOICE_FIELDS)
# These fields are saved as Comma Delimited Strings (usefull for numbers)
STATIC_CHOICE_FIELDS = getattr(settings, "DATAFORMS_STATIC_CHOICE_FIELDS", ())
View
@@ -1,9 +1,9 @@
"""
-Dataforms System
-================
+Dataforms Form API
+==================
See the GettingStarted guide at:
-http://code.google.com/p/django-dataforms/wiki/GettingStarted
+http://readthedocs.org/docs/django-dataforms/en/latest/
"""
from collections import defaultdict
from django import forms
@@ -15,7 +15,7 @@
from django.utils.safestring import mark_safe
from models import DataForm, Collection, Field, FieldChoice, Choice, Answer, \
AnswerChoice, Submission, CollectionDataForm, Section, Binding
-from settings import FIELD_MAPPINGS, SINGLE_CHOICE_FIELDS, MULTI_CHOICE_FIELDS, \
+from app_settings import FIELD_MAPPINGS, SINGLE_CHOICE_FIELDS, MULTI_CHOICE_FIELDS, \
CHOICE_FIELDS, UPLOAD_FIELDS, FIELD_DELIMITER, STATIC_CHOICE_FIELDS, FORM_MEDIA, \
VALIDATION_MODULE
from utils.file import handle_upload, DataFormFile
@@ -66,20 +66,6 @@ def __iter__(self):
def is_valid(self, check_required=True, *args, **kwargs):
"""
:arg check_required: Whether or not to validate required fields. Default True.
-
- DEPRECATED! - process_full_form is no longer needed. File upload logic has changed.
- This was a nasty hack and didn't follow Django form logic. Django forms should ALWAYS
- have all fields passed. This allows proper validation. Using the initial, data, and files
- arguments, you can account for any dynamic logic you need. Omitting fields was always a bad idea.
- :arg process_full_form: If True, all fields in the form POST will be handled normally
- (i.e., unchecked checkboxes will not appear in the form POST and so any
- previously checked answer will be deleted). If False, only fields specified
- in the FORM post will be handled (allowing changes to a subset of field answers
- in the database, if desired, but causes checkboxes to not become unchecked unless
- the key is manually added to the form POST data with a blank string value).
-
- This function *will* affect what the save() function receives to process and
- MUST be called before save() is called.
"""
# We still erase bindings.
View
@@ -4,7 +4,7 @@
from django.db.models.fields import CommaSeparatedIntegerField
from django.utils.translation import ugettext_lazy as _
from fields import SeparatedValuesField
-from settings import FIELD_TYPE_CHOICES, BINDING_OPERATOR_CHOICES, \
+from app_settings import FIELD_TYPE_CHOICES, BINDING_OPERATOR_CHOICES, \
BINDING_ACTION_CHOICES
@@ -43,19 +43,6 @@ def __unicode__(self):
return u'%s in %s (%s)' % (self.collection, self.data_form, self.section)
-# TODO: This probably should be removed since this was app specific.
-class CollectionVersion(models.Model):
- """
- Model that will keep a record of the newest version of a collection
- """
- slug = models.SlugField(verbose_name=_('slug'), max_length=255, unique=True)
- collection = models.ForeignKey('Collection')
- last_modified = models.DateTimeField(auto_now=True)
-
- def __unicode__(self):
- return u"%s (%s)" % (self.slug, self.collection)
-
-
class Section(models.Model):
"""
Model that gives a section to a DataForm within a Collection
@@ -4,7 +4,7 @@
from forms import _field_for_form, \
get_answers # kind of breaking low coupling here
from models import Submission, Answer
-from settings import BOOLEAN_FIELDS, MULTI_CHOICE_FIELDS, UPLOAD_FIELDS
+from app_settings import BOOLEAN_FIELDS, MULTI_CHOICE_FIELDS, UPLOAD_FIELDS
class RequestFactory(Client):
@@ -1,4 +1,4 @@
-from dataforms.settings import FILE_UPLOAD_PATH
+from dataforms.app_settings import FILE_UPLOAD_PATH
from django.conf import settings
from django.core.files.base import File
from django.utils.encoding import smart_str
View
@@ -1,6 +1,6 @@
from django.http import Http404
from django.shortcuts import render
-from settings import FIELD_MAPPINGS, REMOTE_JQUERY_JS, REMOTE_JQUERY_CSS
+from app_settings import FIELD_MAPPINGS, REMOTE_JQUERY_JS, REMOTE_JQUERY_CSS
def build(request):
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
-config: e997b9a51cd5dbb57d4e73c8b0f1a5b8
+config: 13083f9ecd7c913c3596c99ae1786117
tags: fbb0d17656682115ca4d033fb2f83ba1
@@ -1,4 +1,4 @@
.. automodule:: dataforms.forms
- :synopsis: django-dataforms API
+ :synopsis: Dataforms Form API
:members:
:undoc-members:
@@ -1,21 +1,106 @@
-.. django-dataforms documentation master file
+.. django-dataforms - Dynamically database driven Django forms master file, created by
+ sphinx-quickstart on Thu Apr 14 11:03:55 2011.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
-django-dataforms documentation
-==============================
+Getting Started
+===============
-See the API documentation below, or the `Getting Started guide <http://code.google.com/p/django-dataforms/wiki/GettingStarted>`_ to jump in.
+Introduction
+------------
+
+**django-dataforms** is a Django application that that allows Django forms to be
+dynamically data-driven. Django form logic is abstracted to the database layer.
+This allows for quick updates to forms and gives the user access to modify forms
+through the Django admin interface.
+
+
+Requirements
+------------
+
+1. Django 1.3
+
+ **django-dataforms** has only been tested with 1.3. It might work with previous
+ versions, but has not been tested as such.
+
+
+2. JQuery
+
+ **django-dataforms** uses JQuery for parts of the admin interface. JQuery-UI
+ is also used for date picker fields.
+
+
+
+Installation
+------------
+
+To get this application up and running, please follow the steps below:
+
+1. Create a Django production environment using the setup of your choice.
+ Refer to: http://docs.djangoproject.com/en/dev/intro/install/
+
+2. Create a new Django Project::
+
+ $ django-admin.py startproject <projectname>
+
+3. Install django-bft to either your PYTHON_PATH or in a folder inside your project:
+
+ * Install from pip::
+
+ $ pip install django-dataforms
+
+ * `Download`__ and install from source::
+
+ $ python setup.py install
+
+ * Install source to local directory::
+
+ $ python setup.py build
+ $ cp build/lib/bft /<PROJECT_ROOT>/
+
+4. Add the following to your **settings.py** file:
+
+ * Add 'dataforms', 'staticfiles' and 'admin' to INSTALLED_APPS::
+
+ INSTALLED_APPS = (
+ ...
+ 'django.contrib.admin',
+ 'django.contrib.staticfiles',
+ 'dataforms',
+ )
+
+ * Make sure your static file finders are configured::
+
+ STATICFILES_FINDERS = (
+ 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
+ )
+
+5. Modify **app_settings.py** as needed. See :doc:`settings` for specifics.
+
+
+6. Don't forget to collect your static files and sync your database::
+
+ $ python manage.py syncdb
+ $ python manage.py collectstatic
+
+
+__ https://github.com/django-dataforms/dango-dataforms/downloads
-Contents:
.. toctree::
:maxdepth: 2
+ :hidden:
+ concepts
+ settings
+ validation
forms
+ diagram
+
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
-* :ref:`search`
-
+* :ref:`search`
Oops, something went wrong.

0 comments on commit 27d5e38

Please sign in to comment.