Dynamic, database-driven Django forms

Overview

Django Dataforms

django-dataforms is a wrapper for the Django forms API that lets you dynamically define forms in a database, rather than hard-coding form definitions. This can be

especially helpful for projects that have many forms and/or forms which constantly change, and you don't want to be constantly updating models and schemas. No model creation required.

See the Documentaion for more information.

Go from this...

# forms.py
from django import forms

class ContactForm(forms.Form):
    subject = forms.CharField(max_length=100)
    message = forms.CharField()
    sender = forms.EmailField()
    cc_myself = forms.BooleanField(required=False)

# view.py
def contact(request):
    if request.method == 'POST':
        form = ContactForm(request.POST)
        # ...
    else:
        form = ContactForm()

    return render_to_response('contact.html', {'form': form,})

To this!

# Now your form is stored in the database and you can
# change it without changing a model and DB schema!
create_form(request, form="contact-form" submission="mySubmission")
You might also like...
A Django Webapp performing CRUD operations on Library Database.

CRUD operations - Django Library Database A Django Webapp performing CRUD operations on Library Database. Tools & Technologies used: Django MongoDB HT

Comparing Database performance with Django ORM
Comparing Database performance with Django ORM

Comparing Database performance with Django ORM Postgresql MySQL MariaDB SQLite Comparing database operation performance using django ORM. PostgreSQL v

A slick ORM cache with automatic granular event-driven invalidation.

Cacheops A slick app that supports automatic or manual queryset caching and automatic granular event-driven invalidation. It uses redis as backend for

Social Media Network Focuses On Data Security And Being Community Driven Web App

privalise Social Media Network Focuses On Data Security And Being Community Driven Web App The Main Idea: We`ve seen social media web apps that focuse

Meta package to combine turbo-django and stimulus-django

Hotwire + Django This repository aims to help you integrate Hotwire with Django 🚀 Inspiration might be taken from @hotwired/hotwire-rails. We are sti

django-reversion is an extension to the Django web framework that provides version control for model instances.

django-reversion django-reversion is an extension to the Django web framework that provides version control for model instances. Requirements Python 3

Django-environ allows you to utilize 12factor inspired environment variables to configure your Django application.
Django-environ allows you to utilize 12factor inspired environment variables to configure your Django application.

Django-environ django-environ allows you to use Twelve-factor methodology to configure your Django application with environment variables. import envi

Rosetta is a Django application that eases the translation process of your Django projects
Rosetta is a Django application that eases the translation process of your Django projects

Rosetta Rosetta is a Django application that facilitates the translation process of your Django projects. Because it doesn't export any models, Rosett

Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly.
Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly.

Cookiecutter Django Powered by Cookiecutter, Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly. Documentati

Comments
  • Javascript bindings fail when more than one binding

    Javascript bindings fail when more than one binding

    Hi, thank you very much for your app, this is very efficient for what I am building. I have found a bug in the javascript code that bind fields between them. The thing is that the bindings are not actually stored in an array, but in a string (comma-separated), in a one-element array, in the array. I had to modify a bit the code to make it work correctly (line 105 in static/js/bindings.js):

    var tmp = binding.true_field[0][0];
    tmp = tmp.split(",");
    $.each(tmp, function(index, selector){
        ...
    }
    

    (and the same for false fields)

    I assume it would be a better way to correctly fill the array instead of splitting the string, but I can't understand where it is filled. There might be the same problem for true/false choices but I did not try to use them.

    opened by pawamoy 1
  • Image uploads processing - PIL problems

    Image uploads processing - PIL problems

    Once uploaded images do not validate if the form is submitted without changing them. PIL throws IOError (truncated file).

    Changing file's opening mode should help:

    https://github.com/django-dataforms/django-dataforms/blob/master/dataforms/forms.py#L565 - there is 'r' mode, 'rb' should be used probably.

    opened by mateuszpohl 1
  • Some improvements to dataforms

    Some improvements to dataforms

    Hi,

    Eric Liu and I worked on some cool features that we'd like to see merged into the original branch of the project. The features are:

    1 - Support for specifying an "initial" parameter to create_collection and create_form, this can be thought as the same behavior of specifying initial data for a django form. 2 - Enable form fields to have a "placeholder" attribute defined; you know, the HTML5 placeholder attribute :) 3 - Support for a "virtual" (in the sense that it isn't going to be send as a parameter to the field itself, instead it is just used by dataforms itself) field attribute "blank_choice_label", which is used to change the default option "--------" on select fields (a use case is when you have a "State" dropdown and you want the default option to be "[Select State]").

    Please, let me know what you think.

    Thanks!

    opened by chromano 1
Owner
null
Money fields for Django forms and models.

django-money A little Django app that uses py-moneyed to add support for Money fields in your models and forms. Django versions supported: 1.11, 2.1,

null 1.4k Jan 6, 2023
A Django application that provides country choices for use with forms, flag icons static files, and a country field for models.

Django Countries A Django application that provides country choices for use with forms, flag icons static files, and a country field for models. Insta

Chris Beaven 1.2k Jan 7, 2023
A set of high-level abstractions for Django forms

django-formtools Django's "formtools" is a set of high-level abstractions for Django forms. Currently for form previews and multi-step forms. This cod

Jazzband 621 Dec 30, 2022
A Django application that provides country choices for use with forms, flag icons static files, and a country field for models.

Django Countries A Django application that provides country choices for use with forms, flag icons static files, and a country field for models. Insta

Chris Beaven 1.2k Dec 31, 2022
☄️ Google Forms autofill script

lazrr 'Destroy Them With Lazers' - Knife Party, 2011 Google Forms autofill script Installation: pip3 install -r requirements.txt Usage: python3 lazrr.

Serezha Rakhmanov 12 Jun 4, 2022
A CBV to handle multiple forms in one view

django-shapeshifter A common problem in Django is how to have a view, especially a class-based view that can display and process multiple forms at onc

Kenneth Love 167 Nov 26, 2022
Domain-driven e-commerce for Django

Domain-driven e-commerce for Django Oscar is an e-commerce framework for Django designed for building domain-driven sites. It is structured such that

Oscar 5.6k Jan 1, 2023
Django URL Shortener is a Django app to to include URL Shortening feature in your Django Project

Django URL Shortener Django URL Shortener is a Django app to to include URL Shortening feature in your Django Project Install this package to your Dja

Rishav Sinha 4 Nov 18, 2021
Dynamic Django settings.

Constance - Dynamic Django settings A Django app for storing dynamic settings in pluggable backends (Redis and Django model backend built in) with an

Jazzband 1.5k Jan 7, 2023
Use Database URLs in your Django Application.

DJ-Database-URL This simple Django utility allows you to utilize the 12factor inspired DATABASE_URL environment variable to configure your Django appl

Jacob Kaplan-Moss 1.3k Dec 30, 2022