Installation¶
Warning
django-dynamic-forms 0.4.x will be the latest version branch that supports Django < 1.7!
Install django-dynamic-forms into your virtual environment or you site-packages using pip:
$ pip install django-dynamic-forms
If you already use the wheel package format you can use the wheel build:
$ pip install --use-wheel django-dynamic-forms
To make django-dynamic-forms available in your Django project, you first have to add it to the INSTALLED_APPS in your settings.py. If you are unsure where to put it, just append it:
INSTALLED_APPS = (
...
'dynamic_forms',
...
)
To make Django aware of the dynamic forms while processing the requests / responses you need to add the FormModelMiddleware to the list of MIDDLEWARE_CLASSES. The best place is probably at the end of the list. If your forms are not shown please refer to the known problems section of the documentation:
MIDDLEWARE_CLASSES = (
...
'dynamic_forms.middlewares.FormModelMiddleware'
)
Last but not least you need to add the 'dynamic_forms.urls' urlpatterns to your project’s URL patterns:
urlpatterns = patterns('',
...
url(r'^dynamic_forms/',
include('dynamic_forms.urls', namespace='dynamic_forms')),
...
)
Important
Make sure that you get the namespace straight: dynamic_forms!
Finally you have to update your database. If you use Django>=1.7 you need to run:
$ python manage.py migrate dynamic_forms
If you use South you need to run:
$ python manage.py syncdb
$ python manage.py migrate
otherwise, if you don’t use South or if you use Django<1.7, you have to run:
$ python manage.py syncdb