All Projects → idlesign → django-siteforms

idlesign / django-siteforms

Licence: BSD-3-Clause license
Django reusable app to simplify form construction

Programming Languages

python
139335 projects - #7 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to django-siteforms

Forms Angular
Probably the most opinionated framework in the world
Stars: ✭ 412 (+2646.67%)
Mutual labels:  forms, form-builder
Rsformview
A Cocoapods library designed to easily create forms with multiple data entry fields
Stars: ✭ 84 (+460%)
Mutual labels:  forms, form-builder
Django Rest Formly
Generate angular-formly form configuration object for Django REST endpoints.
Stars: ✭ 7 (-53.33%)
Mutual labels:  forms, form-builder
view component-form
Rails FormBuilder for ViewComponent
Stars: ✭ 120 (+700%)
Mutual labels:  forms, form-builder
Forms
📝 Simple form & survey app for Nextcloud
Stars: ✭ 127 (+746.67%)
Mutual labels:  forms, form-builder
Django Fobi
Form generator/builder application for Django done right: customisable, modular, user- and developer- friendly.
Stars: ✭ 360 (+2300%)
Mutual labels:  forms, form-builder
Formium
The headless form builder for the modern web.
Stars: ✭ 78 (+420%)
Mutual labels:  forms, form-builder
grav-plugin-form
Grav Form Plugin
Stars: ✭ 48 (+220%)
Mutual labels:  forms, form-builder
Form Manager
PHP library to create and validate html forms
Stars: ✭ 124 (+726.67%)
Mutual labels:  forms, form-builder
Form For
ReactJS forms made easy
Stars: ✭ 118 (+686.67%)
Mutual labels:  forms, form-builder
Tellform
✏️ Free Opensource Alternative to TypeForm or Google Forms ⛺
Stars: ✭ 2,941 (+19506.67%)
Mutual labels:  forms, form-builder
Core
The Form Tools Core.
Stars: ✭ 156 (+940%)
Mutual labels:  forms, form-builder
Formvuelate
Dynamic schema-based form rendering for VueJS
Stars: ✭ 262 (+1646.67%)
Mutual labels:  forms, form-builder
React Hook Form
📋 React Hooks for form state management and validation (Web + React Native)
Stars: ✭ 24,831 (+165440%)
Mutual labels:  forms, form-builder
React Reactive Form
Angular like reactive forms in React.
Stars: ✭ 259 (+1626.67%)
Mutual labels:  forms, form-builder
Usetheform
React library for composing declarative forms, manage their state, handling their validation and much more.
Stars: ✭ 40 (+166.67%)
Mutual labels:  forms, form-builder
react-emotion-multi-step-form
React multi-step form library with Emotion styling
Stars: ✭ 25 (+66.67%)
Mutual labels:  forms, form-builder
yii2-forms
Forms CRUD - formbuilder, generator code
Stars: ✭ 32 (+113.33%)
Mutual labels:  forms, form-builder
Uniforms
A React library for building forms from any schema.
Stars: ✭ 1,368 (+9020%)
Mutual labels:  forms, form-builder
Formmaster
Easily build big and bigger forms with minimal effort
Stars: ✭ 152 (+913.33%)
Mutual labels:  forms, form-builder

django-siteforms

https://github.com/idlesign/django-siteforms

release lic coverage

Description

Django reusable app to simplify form construction

For those who consider maintaining templates-based forms solutions for Django a burden.

Features:

  • Full form rendering support, including prolog and submit button
  • Subforms support (represent entire other form as a form field): JSON, Foreign Key, Many-to-Many
  • Field groups
  • Declarative attributes for elements
  • Simplified declarative forms layout, allowing fields ordering
  • Simple ways to make fields hidden, disabled, readonly
  • Aria-friendly (Accessible Rich Internet Applications)
  • Complex widgets (e.g. using values from multiple fields) support

Supported styling:

  • No CSS
  • Bootstrap 4

Usage

To render a form in templates just address a variable, e.g. <div>{{ form }}</div>.

Note

By default there's no need to add a submit button and wrap it all into <form>.

Basic

Let's show how to build a simple form.

from django.shortcuts import render
from siteforms.composers.bootstrap4 import Bootstrap4
from siteforms.toolbox import ModelForm


class MyForm(ModelForm):
    """This form will show us how siteforms works."""

    disabled_fields = {'somefield'}  # Declarative way of disabling fields.
    hidden_fields = {'otherfield'}  # Declarative way of hiding fields.
    readonly_fields = {'anotherfield'}  # Declarative way of making fields readonly.

    class Composer(Bootstrap4):
        """This will instruct siteforms to compose this
        form using Bootstrap 4 styling.

        """
    class Meta:
        model = MyModel  # Suppose you have a model class already.
        fields = '__all__'

def my_view(request):
    # Initialize form using data from POST.
    my_form = MyForm(request=request, src='POST')
    is_valid = form.is_valid()
    return render(request, 'mytemplate.html', {'form': my_form})

Composer options

Now let's see how to tune our form.

from siteforms.composers.bootstrap4 import Bootstrap4, FORM, ALL_FIELDS

class Composer(Bootstrap4):

    opt_size='sm'  # Bootstrap 4 has sizes, so let's make our form small.

    # Element (fields, groups, form, etc.) attributes are ruled by `attrs`.
    # Let's add rows=2 to our `contents` model field.
    attrs={'contents': {'rows': 2}}

    # To group fields into named groups describe them in `groups`.
    groups={
        'basic': 'Basic attributes',
        'other': 'Other fields',
    }

    # We apply custom layout to our form.
    layout = {
        FORM: {
            'basic': [  # First we place `basic` group.
                # The following three fields are in the same row -
                # two fields in the right column are stacked.
                ['title', ['date_created',
                           'date_updated']],
                'contents',  # This one field goes into a separate row.
            ],
            # We place all the rest fields into `other` group.
            'other': ALL_FIELDS,
        }
    }

Documentation

https://django-siteforms.readthedocs.org/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].