Skip to content

Django form fields not well supported #113

Closed
@nimasmi

Description

@nimasmi

If a template contains {% for field in form %} or even {% if form %}, then it's easy enough to render in django-pattern-library so long as we force the form to be null in the YAML context, and are happy not to have the form.

If the form is rendered explicitly by field names, then it requires a lot more work, and support for this is not documented. I had a quick go, but my template has things like:

            {% include "patterns/molecules/form_field.html" with field=form.email %}

and that template has a custom filter: {{ field|field_type }} which necessitated YAML like:

  form:
    email:
      bound_field:
        field:
          widget:
            class:
              __name__: char_field

I didn't go much further, because these is even more convoluted markup in my chosen template, and it wasn't a high enough priority.

Metadata

Metadata

Assignees

No one assigned

    Labels

    djangoRelated to Django templates capabilitiesenhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions