Skip to content

[FEATURE] Easily render django forms in component templates instead of manually typing in each field. #745

Open
@Nizzy94

Description

@Nizzy94

Why do we need this improvement?

In most of my Django projects, I render my form from the view, and I believe most of the Django developers out there use it to make life easier. here is the case: I have customised all my Django form controls(inputs, select, textarea, etc.) using tailwind, and I wanted to use it in a unicorn template, but then I got an error that says the form is not JSON serialisable. this is a form I am using on other parts of the site, so I do the same. I can't just type out the whole thing again.

How will this change help?

if there is a way to not serialise the form so that it goes straight to the template as a Django form and not JSON data, that would help. then, in the unicorn view, we can do the validation and submission, etc.

Please add screenshots if applicable

How could it be implemented/designed?

I'm not sure if this would work, but sending two forms of data to the template makes sense. serialized data, and python data.

another option is to add a method that will create a dictionary from the form_class attribute, containing all the essential data needed to render the form.

Will this be a breaking change?

  • Yes
  • No

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions