Package: django-template-forms
Template based form rendering for DjangoOverviewDjango 1.11 recently introduced template-based widget rendering to allow
easier customization of widgets by users.django-template-formsis
the logical extension of this feature, implementing template-based
rendering for fields and forms.At this point, simple block forms are supported for Bootstrap 3 & 4.
Horizontal forms and check/radio field layouts are inbound.RequirementsPython: 3.4, 3.5, 3.6Django: 1.11, 2.0bInstall with pip:$pipinstalldjango-template-formsConfigurationOnce installed, add'template_forms'to yourINSTALLED_APPS.INSTALLED_APPS=[...'template_forms',]UsageAlltemplate_formsform classes inherit fromdjango.forms.BaseFormand are intended to be mixed with a concreteforms.Formorfroms.ModelForm. Example usage:fromdjangoimportformsfromtemplate_formsimportbs3from.modelsimportArticleclassArticleForm(bs3.BlockForm,forms.ModelForm):classMeta:model=Articlefields=['title','author','published_date',...]In theviewtemplate:<formmethod="post"action="">{% csrf_token %}
    {{ form }}<buttonclass="btn btn-primary"type="submit">Save</button></form>TODO:Document creation of customTemplateFormsubclass.Overriding Templatesdjango-template-formsprovides a default set of templates. To
override these, you first need to consider the`FORM_RENDERER<https://docs.djangoproject.com/en/1.11/ref/settings/#std:setting-FORM_RENDERER>`__
setting, then override the relevant template files. By default,FORM_RENDERERuses the`DjangoTemplates<https://docs.djangoproject.com/en/1.11/ref/forms/renderers/#djangotemplates>`__
renderer, which loads templates from your installed apps.If you want more control over template loading, you can use the`TemplatesSetting<https://docs.djangoproject.com/en/1.11/ref/forms/renderers/#templatessetting>`__
renderer, which loads templates from using your configuredTEMPLATESsetting. If you use this renderer, you may need to add'django.forms'to yourINSTALLED_APPS. See therenderer
docsfor more information.INSTALLED_APPS=[...'django.forms','template_forms',]FORM_RENDERER='django.forms.renderers.TemplatesSetting'TEMPLATES=[{'BACKEND':'django.template.backends.django.DjangoTemplates','DIRS':[...],'APP_DIRS':True,...},]Templates are provided for each supported CSS framework.Note:- horizontal layouts do not exist yet for BS 4. - check &
radio field templates do not exist yet.BS3:template_forms/bs3/forms/block.htmltemplate_forms/bs3/forms/horizontal.htmltemplate_forms/bs3/fields/block.htmltemplate_forms/bs3/fields/block_checkbox.html[STRIKEOUT:template_forms/bs3/fields/block_check_inline.html][STRIKEOUT:template_forms/bs3/fields/block_check_stacked.html][STRIKEOUT:template_forms/bs3/fields/block_radio_inline.html][STRIKEOUT:template_forms/bs3/fields/block_radio_stacked.html]template_forms/bs3/fields/horizontal.htmltemplate_forms/bs3/fields/horizontal_checkbox.html[STRIKEOUT:template_forms/bs3/fields/horizontal_check_inline.html][STRIKEOUT:template_forms/bs3/fields/horizontal_check_stacked.html][STRIKEOUT:template_forms/bs3/fields/horizontal_radio_inline.html][STRIKEOUT:template_forms/bs3/fields/horizontal_radio_stacked.html]BS4:template_forms/bs4/forms/block.html[STRIKEOUT:template_forms/bs4/forms/horizontal.html]template_forms/bs4/fields/block.html[STRIKEOUT:template_forms/bs4/fields/block_checkbox.html][STRIKEOUT:template_forms/bs4/fields/block_check_inline.html][STRIKEOUT:template_forms/bs4/fields/block_check_stacked.html][STRIKEOUT:template_forms/bs4/fields/horizontal.html][STRIKEOUT:template_forms/bs4/fields/horizontal_checkbox.html][STRIKEOUT:template_forms/bs4/fields/horizontal_check_inline.html][STRIKEOUT:template_forms/bs4/fields/horizontal_check_stacked.html]Running the testsThe test suite requirestoxandtox-venv. The full list of
builds is viewable withtox-l.$pipinstalltoxtox-venv$tox-epy36-django111$tox-elint,isortRelease ProcessUpdate package version in setup.pyCreate git tag for versionUpload release to PyPIsh   $ pip install-Usetuptools wheel pypandoc   $ rm-rfdist/ build/   $ python setup.py bdist_wheel uploadCopyright & LicenseCopyright © 2017 Ryan P Kilby. See LICENSE for details.