{"id":14972906,"url":"https://github.com/idlesign/django-siteforms","last_synced_at":"2025-08-30T16:32:59.441Z","repository":{"id":47371771,"uuid":"262929994","full_name":"idlesign/django-siteforms","owner":"idlesign","description":"Django reusable app to simplify form construction","archived":false,"fork":false,"pushed_at":"2023-09-08T14:52:08.000Z","size":207,"stargazers_count":17,"open_issues_count":3,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-01T00:23:48.424Z","etag":null,"topics":["boostrap4","django","django-application","form-builder","forms"],"latest_commit_sha":null,"homepage":"https://github.com/idlesign/django-siteforms","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/idlesign.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG","contributing":"CONTRIBUTING","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-11T03:32:54.000Z","updated_at":"2023-10-06T21:15:28.000Z","dependencies_parsed_at":"2023-02-17T19:16:10.158Z","dependency_job_id":null,"html_url":"https://github.com/idlesign/django-siteforms","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idlesign%2Fdjango-siteforms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idlesign%2Fdjango-siteforms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idlesign%2Fdjango-siteforms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idlesign%2Fdjango-siteforms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idlesign","download_url":"https://codeload.github.com/idlesign/django-siteforms/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238397227,"owners_count":19465136,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["boostrap4","django","django-application","form-builder","forms"],"created_at":"2024-09-24T13:47:43.577Z","updated_at":"2025-02-12T01:33:16.683Z","avatar_url":"https://github.com/idlesign.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"django-siteforms\n================\nhttps://github.com/idlesign/django-siteforms\n\n|release| |lic| |coverage|\n\n.. |release| image:: https://img.shields.io/pypi/v/django-siteforms.svg\n    :target: https://pypi.python.org/pypi/django-siteforms\n\n.. |lic| image:: https://img.shields.io/pypi/l/django-siteforms.svg\n    :target: https://pypi.python.org/pypi/django-siteforms\n\n.. |coverage| image:: https://img.shields.io/coveralls/idlesign/django-siteforms/master.svg\n    :target: https://coveralls.io/r/idlesign/django-siteforms\n\n\nDescription\n-----------\n\n*Django reusable app to simplify form construction*\n\nFor those who consider maintaining templates-based forms solutions for Django a burden.\n\nFeatures:\n\n* Full form rendering support, including prolog and submit button\n* Subforms support (represent entire other form as a form field): JSON, Foreign Key, Many-to-Many\n* Field groups\n* Declarative attributes for elements\n* Simplified declarative forms layout, allowing fields ordering\n* Simple ways to make fields hidden, disabled, readonly\n* Support for fields from model's properties\n* Aria-friendly (Accessible Rich Internet Applications)\n* Complex widgets (e.g. using values from multiple fields) support\n* Filter-forms (use form for queryset filtering)\n\nSupported styling:\n\n* No CSS\n* Bootstrap 4\n* Bootstrap 5\n\n\nUsage\n-----\n\nTo render a form in templates just address a variable, e.g. ``\u003cdiv\u003e{{ form }}\u003c/div\u003e``.\n\n.. note:: By default there's no need to add a submit button and wrap it all into ``\u003cform\u003e``.\n\nBasic\n~~~~~\n\nLet's show how to build a simple form.\n\n.. code-block:: python\n\n    from django.shortcuts import render\n    from siteforms.composers.bootstrap5 import Bootstrap5\n    from siteforms.toolbox import ModelForm\n\n\n    class MyForm(ModelForm):\n        \"\"\"This form will show us how siteforms works.\"\"\"\n        \n        disabled_fields = {'somefield'}  # Declarative way of disabling fields.\n        hidden_fields = {'otherfield'}  # Declarative way of hiding fields.\n        readonly_fields = {'anotherfield'}  # Declarative way of making fields readonly.\n\n        class Composer(Bootstrap5):\n            \"\"\"This will instruct siteforms to compose this\n            form using Bootstrap 5 styling.\n\n            \"\"\"\n        class Meta:\n            model = MyModel  # Suppose you have a model class already.\n            fields = '__all__'\n\n    def my_view(request):\n        # Initialize form using data from POST.\n        my_form = MyForm(request=request, src='POST')\n        is_valid = form.is_valid()\n        return render(request, 'mytemplate.html', {'form': my_form})\n\n\nComposer options\n~~~~~~~~~~~~~~~~\n\nNow let's see how to tune our form.\n\n.. code-block:: python\n\n    from siteforms.composers.bootstrap5 import Bootstrap5, FORM, ALL_FIELDS\n\n    class Composer(Bootstrap5):\n\n        opt_size='sm'  # Bootstrap 5 has sizes, so let's make our form small.\n\n        # Element (fields, groups, form, etc.) attributes are ruled by `attrs`.\n        # Let's add rows=2 to our `contents` model field.\n        attrs={'contents': {'rows': 2}}\n\n        # To group fields into named groups describe them in `groups`.\n        groups={\n            'basic': 'Basic attributes',\n            'other': 'Other fields',\n        }\n\n        # We apply custom layout to our form.\n        layout = {\n            FORM: {\n                'basic': [  # First we place `basic` group.\n                    # The following three fields are in the same row -\n                    # two fields in the right column are stacked.\n                    ['title', ['date_created',\n                               'date_updated']],\n                    'contents',  # This one field goes into a separate row.\n                ],\n                # We place all the rest fields into `other` group.\n                'other': ALL_FIELDS,\n            }\n        }\n\n\nDocumentation\n-------------\n\nhttps://django-siteforms.readthedocs.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidlesign%2Fdjango-siteforms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidlesign%2Fdjango-siteforms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidlesign%2Fdjango-siteforms/lists"}