Full control of form rendering in the templates.

Overview

django-floppyforms

Jazzband GitHub Actions Coverage

Full control of form rendering in the templates.

  • Authors: Gregor Müllegger and many many contributors
  • Original creator: Bruno Renié started this project and kept it going for many years.
  • Licence: BSD
  • Requirements: homework -- read this.

Installation

  • pip install -U django-floppyforms
  • Add floppyforms to your INSTALLED_APPS

For those who want to mix and match with vanilla Django widgets, it is also recommended to put Django's form template directory into your template directories:

# in your template configuration
TEMPLATES = [{
    ...,
    # inside the directories parameter
    'DIRS': [
        # include django's form templates
        os.path.join(
            os.path.dirname(django.__file__), "forms/templates/"
        ),
        ... # the rest of your template directories
}]

For extensive documentation see the docs folder or read it on readthedocs

To install the in-development version of django-floppyforms, run pip install "https://github.com/jazzband/django-floppyforms/tarball/master#egg=django-floppyforms".

Help

Create a ticket in the issues section on github or ask your questions on the #django-floppyforms IRC channel on freenode.

You can get professional consulting regarding django-floppyforms or any other Django related work from django-floppyforms' maintainer Gregor Müllegger.

Bugs

Really? Oh well... Please Report. Or better, fix :) We are happy to help you through the process of fixing and testing a bug. Just get in touch.

Development

Thanks for asking!

Get the code:

git clone [email protected]:jazzband/django-floppyforms.git
cd django-floppyforms
virtualenv env
source env/bin/activate
add2virtualenv .

Install the development requirements:

pip install "tox>=1.8"

Currently, you'll need to install the GeoDjango requirements when running tests.

Run the tests:

tox
tox -e py36-22

You can see all the supported test configurations with tox -l.

Comments
  • How to put in all the types of fields in one map and also all the types of maps in one placeholder ?

    How to put in all the types of fields in one map and also all the types of maps in one placeholder ?

    First of all , a brilliant application , and thank you for all the help till now .

    This is my forms.py

    from django import forms from openmaps.models import Open_Layers from django.contrib.admin import widgets
    import floppyforms as forms class PointWidget(forms.gis.PointWidget, forms.gis.BaseGMapWidget): pass class MultiPointWidget(forms.gis.MultiPointWidget,forms.gis.BaseGMapWidget): pass class LineStringWidget(forms.gis.LineStringWidget,forms.gis.BaseGMapWidget): pass class PolygonWidget(forms.gis.PolygonWidget,forms.gis.BaseGMapWidget): pass class MultiPolygonWidget(forms.gis.MultiPolygonWidget,forms.gis.BaseGMapWidget): pass class GeoForm(forms.Form): point = forms.gis.PointField() multipoint = forms.gis.MultiPointField() line = forms.gis.LineStringField() poly = forms.gis.PolygonField() multipoly= forms.gis.MultiPolygonField()

    According to this , all the points , multipoints , line etc load in separate openlayers maps , but in the same page . Is it by anychance possible to put in all the geometries in one map . And also , allow to change between maps like openlayers , osm , google maps using layerswitcher .

    opened by ghost 29
  • TypeError: get_context() got an unexpected keyword argument 'renderer' on Django 1.11.3

    TypeError: get_context() got an unexpected keyword argument 'renderer' on Django 1.11.3

    The error in the title is raised for Floppyforms widgets on Django 1.11.3 because of the change in this ticket (code here). The solution for now is to stay on 1.11.2 or lower until this is fixed in Floppyforms.

    opened by Gwildor 27
  • local copy of openlayers.js

    local copy of openlayers.js

    hello,

    May be it's no relevant, but I would like to have a local copy of openlayers, and google (js and css) instead of getting them via their absolute URL.

    • how can I achieve this ? (we could have sort of settings for that, instead of modify the widget Media class of BaseGMapWidget BaseOsmWidget or BaseMetacartaWidget)
    • how interesting is it to use, for example django_compressor, to increase performance ?

    thx

    opened by ouhouhsami 12
  • Unable to import floppyforms.gis, geometry widgets not available

    Unable to import floppyforms.gis, geometry widgets not available

    /home/foo/anaconda2/envs/flightsayer/lib/python2.7/site-packages/floppyforms/init.py:16: UserWarning: Unable to import floppyforms.gis, geometry widgets not available "Unable to import floppyforms.gis, geometry widgets not available")

    Ok, I get that this happens on "from . import gis", but I don't understand what's going on.

    (Everything worked fine until this morning, after I upgraded some stuff on my computer, and now I'm seeing this message and AHHHHH)

    opened by foobarbaz2 9
  • Allow override of template_name in __init__() and render().

    Allow override of template_name in __init__() and render().

    This fixes #89, allowing override of template_name in both __init__() (useful if you want to use the same widget class with two different templates without extra subclasses) and in render() (useful for more advanced use cases where you want to render the same widget instance on the same form field with two different templates, conditional on something).

    Tests are included and pass on a full tox run.

    I would happily add some docs as well, but in a quick perusal I didn't see where they would fit. As far as I can tell the individual widget classes are documented, but the core widget API isn't so far.

    opened by carljm 9
  • decimalfield should specify step=any

    decimalfield should specify step=any

    To avoid a validation error in chrome when entering decimals, the DecimalField template should specify

    <input type="number" step="any" />
    

    See: http://blog.isotoma.com/2012/03/html5-input-typenumber-and-decimalsfloats-in-chrome/

    What I have done so far is this:

    Added this to input.html:

    {% if attrs.decimal %}step="any"{% endif %}
    

    And created a new widget like this:

    class DecimalInput(floppyforms.widgets.NumberInput):
        def __init__(self, *args, **kwargs):
            kwargs['attrs'] = {'decimal':True}
            super(DecimalWidget, self).__init__(*args, **kwargs)
    
    Bug Needs patch plz! 
    opened by puterleat 9
  • Allow floppyforms to override default form widgets

    Allow floppyforms to override default form widgets

    Currently the documentation states "As for ModelForms, all the fields coming from the model still get a widget from django.forms and not from floppyforms, unless the widgets are overridden in the form’s Meta inner class." The reason for this is because Django has no officially sanctioned way for a form library to override this. The unofficial way would be to override the formfield_callback method but due to a quirk in Django's behavior, that gets lost in the inheritance chain.

    There has been some discussion of how to best achieve this but no decisions have been made yet. We want to pick an implementation that is along the design path of Django itself.

    opened by poswald 9
  • HTML5

    HTML5 "required" validation breaks formset empty forms.

    The empty forms on a formset may have multiple extra empty forms. If one of the extra forms remains empty, but has any "required" fields, browsers that support HTML5 pre-submit validation (like Chrome) will refuse to submit the formset (even though it would be valid according to Django's logic.)

    Django's admin doesn't have this problem because it just doesn't set the "required" attribute on any form fields. Maybe floppyforms should just do the same? Seems less complicated than the alternatives.

    opened by melinath 8
  • Bug fix: Input turns 1 to False

    Bug fix: Input turns 1 to False

    I have a Slider widget that was failing randomly. After spending several hours trying to find what was happening, I found that Input class turns True values into False. As you know, integer 1 equals to True in Python, therefore this code turns integers 1 into False. Thus my sliders where failing where value, min, max or step were equal to 1.

    I've created a test and commented the lines that were breaking my Sliders. Even though all tests pass, you might want to change the code for your checked stuff.

    One thing that I don't find very pythonic is the way True is checked:

    if value == True:
    

    Wouldn't it be better to do:

    if value:
    

    Cheers, Miguel

    opened by maraujop 8
  • Django 1.11 support

    Django 1.11 support

    This tries to pull in various 1.11 fixes into one place, as well as test 1.11 properly

    (This also reduces the scope of what the project tests to supported versions of Django)

    opened by rtpg 6
  • Implementation of DateInput widget should render hardcoded

    Implementation of DateInput widget should render hardcoded "%Y-%m-%d" format

    Implementation of DateInput widget should render hardcoded "%Y-%m-%d" format.

    1. In Django > 1.6 ISO formats are automatically appended to the list of input formats, unless they are not at first position. (see https://github.com/django/django/commit/90d3af380e8efec0301dd91600c6686232de3943)
    2. floppyforms DateInput and DateTimeInput both uses first available format which is often not required "%Y-%m-%d" format. (https://github.com/gregmuellegger/django-floppyforms/blob/master/floppyforms/widgets.py#L279)

    This renders date input as empty in browsers that support date html5 type, requiring user to enter date again:

    <input type="date" name="date_of_birth" value="10.07.2014" required="" class="dateinput form-control" id="id_date_of_birth">
    

    That in chrome renders as "dd/mm/yyyy" instead of "10/07/2014", client validation will not allow form to submit if it is required field and would set field to None if it is not required field, thus loosing information.

    I propose that DateInput widget always render value in rfc3339 format.

    Reference: https://github.com/gregmuellegger/django-floppyforms/issues/27

    opened by bmihelac 6
  • docs: Fix a few typos

    docs: Fix a few typos

    There are small typos in:

    • docs/customization.rst
    • docs/differences.rst
    • floppyforms/static/floppyforms/js/MapWidget.js

    Fixes:

    • Should read seamlessly rather than seemlesly.
    • Should read returned rather than returnes.
    • Should read attributes rather than attibutes.

    Semi-automated pull request generated by https://github.com/timgates42/meticulous/blob/master/docs/NOTE.md

    opened by timgates42 1
  • Jazzband: Synced file(s) with jazzband/.github

    Jazzband: Synced file(s) with jazzband/.github

    opened by jazzband-bot 1
  • set extent of map using map_options

    set extent of map using map_options

    i am trying to draw polygon on using floppy-form map in geodjango is there a way by which i can restrict user to draw polygon in certain restricted area using map_options

    in short i want to know how so i set map boundaries extent using JavaScript code for floppy form i know there is option for that in geodjango floppyform : "map_options"

    but i don't know how do i set that can someone help me ?

    opened by dhirajshinde121083 3
  • geodjango floppyform issue

    geodjango floppyform issue

    Hi i am new to geodjango floppyform, i have some difficulty i working on application where i need to restrict user to create point or line-string(route) withing certain geofence(city), so in short while user creating route map would allow to create point and linestring (route) in certain regien by keeping other part of map disabled ? e.g i want to make entry for bust stop as a point A but while creating i want to restrict user so that point should be created in "XYZ" city region of the map only, it should not allow user to create any entry out of the bbox of XYZ city, is it possible ? can someone please guide me ? my map contain 100 such cities

    opened by dhirajshinde121083 0
  • fetch for the issue 189. disable gis feature on settings.py

    fetch for the issue 189. disable gis feature on settings.py

    https://github.com/gregmuellegger/django-floppyforms/issues/189

    If don't want to use django's gis feature. Can disable to add FLOPPY_FORMS_USE_GIS = False option. It's simple fetch.

    opened by wapj 4
Owner
Jazzband
We are all part of this
Jazzband
A flexible forms validation and rendering library for Python.

WTForms WTForms is a flexible forms validation and rendering library for Python web development. It can work with whatever web framework and template

WTForms 1.4k Dec 31, 2022
A Python HTML form library.

Deform Introduction Use cases Installation Example Status Projects using Deform Community and links Introduction Deform is a Python form library for g

Pylons Project 391 Jan 3, 2023
A platform independent django form serializer

django-remote-forms A package that allows you to serialize django forms, including fields and widgets into Python dictionary for easy conversion into

WiserTogether, Inc. 219 Sep 20, 2022
Automate your google form here!

Google Form Filler (GFF) - Automate your google form here! About The idea of this project came from my online lectures as one of my professors takes a

Jay Thorat 13 Jan 5, 2023
Easy and free contact form on your HTML page. No backend or JS required.

Easy and free contact form on your HTML page. No backend or JS required. ?? ??

0xDEADF00D 8 Dec 16, 2022
The best way to have DRY Django forms. The app provides a tag and filter that lets you quickly render forms in a div format while providing an enormous amount of capability to configure and control the rendered HTML.

django-crispy-forms The best way to have Django DRY forms. Build programmatic reusable layouts out of components, having full control of the rendered

null 4.6k Jan 5, 2023
The best way to have DRY Django forms. The app provides a tag and filter that lets you quickly render forms in a div format while providing an enormous amount of capability to configure and control the rendered HTML.

django-crispy-forms The best way to have Django DRY forms. Build programmatic reusable layouts out of components, having full control of the rendered

null 4.6k Dec 31, 2022
Full control of form rendering in the templates.

django-floppyforms Full control of form rendering in the templates. Authors: Gregor Müllegger and many many contributors Original creator: Bruno Renié

Jazzband 811 Dec 1, 2022
Full control of form rendering in the templates.

django-floppyforms Full control of form rendering in the templates. Authors: Gregor Müllegger and many many contributors Original creator: Bruno Renié

Jazzband 811 Dec 1, 2022
Tweak the form field rendering in templates, not in python-level form definitions. CSS classes and HTML attributes can be altered.

django-widget-tweaks Tweak the form field rendering in templates, not in python-level form definitions. Altering CSS classes and HTML attributes is su

Jazzband 1.8k Jan 2, 2023
Tweak the form field rendering in templates, not in python-level form definitions. CSS classes and HTML attributes can be altered.

django-widget-tweaks Tweak the form field rendering in templates, not in python-level form definitions. Altering CSS classes and HTML attributes is su

Jazzband 1.8k Jan 6, 2023
Blender Game Engine Game Type Templates Logic Bricks (and Python script) based Game Templates for Blender

Blender-Game-Engine-Templates Blender Game Engine Game Type Templates Logic Bric

null 3 Oct 25, 2022
Library and command-line utility for rendering projects templates.

A library for rendering project templates. Works with local paths and git URLs. Your project can include any file and Copier can dynamically replace v

null 808 Jan 4, 2023
JTEX is a command line tool (CLI) for rendering LaTeX documents from jinja-style templates.

JTEX JTEX is a command line tool (CLI) for rendering LaTeX documents from jinja-style templates. This package uses Jinja2 as the template engine with

Curvenote 15 Dec 21, 2022
GMailBomber is a form of Internet abuse which is perpetrated through the sending of massive volumes of email to a specific email address with the goal of overflowing the mailbox and overwhelming the mail server hosting the address, making it into some form of denial of service attack.

GMailBomber is a form of Internet abuse which is perpetrated through the sending of massive volumes of email to a specific email address with the goal of overflowing the mailbox and overwhelming the mail server hosting the address, making it into some form of denial of service attack.

Muneeb 5 Nov 13, 2022
Resolve form field arguments dynamically when a form is instantiated

django-forms-dynamic Resolve form field arguments dynamically when a form is instantiated, not when it's declared. Tested against Django 2.2, 3.2 and

DabApps 108 Jan 3, 2023
Vue + Django with no compromises. Django Templates and Vue SFCs in harmony without sacrificing the full power of either.

Cookiecutter Vue Django Vue + Django with no compromise. Cookiecutter Vue Django is a framework for jumpstarting production-ready Django + Vue project

Mike Hoolehan 122 Dec 22, 2022
NeRViS: Neural Re-rendering for Full-frame Video Stabilization

Neural Re-rendering for Full-frame Video Stabilization

Yu-Lun Liu 9 Jun 17, 2022
Neural Re-rendering for Full-frame Video Stabilization

NeRViS: Neural Re-rendering for Full-frame Video Stabilization Project Page | Video | Paper | Google Colab Setup Setup environment for [Yu and Ramamoo

Yu-Lun Liu 9 Jun 17, 2022
Full body anonymization - Realistic Full-Body Anonymization with Surface-Guided GANs

Realistic Full-Body Anonymization with Surface-Guided GANs This is the official

Håkon Hukkelås 30 Nov 18, 2022