Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

django_form component #36

Open
Archmonger opened this issue Jan 9, 2022 · 1 comment · May be fixed by #212
Open

django_form component #36

Archmonger opened this issue Jan 9, 2022 · 1 comment · May be fixed by #212

Comments

@Archmonger
Copy link
Contributor

Archmonger commented Jan 9, 2022

Old Behavior

Currently, there is no existing way to easily utilize Django Forms (and django-crispy-forms) within ReactPy.

A lot of Django users have the expectation that they can use battle-tested form validation, so this is an important feature.

Implementation Details

Create a reactpy_django.components.django_form that calls Form.render(), then use html_to_vdom to convert into a ReactPy component.

By default, django_form should intercept the on_submit event for html.form to perform Django validation.

@component
def my_component():
    return html.div(
        django_form(MyDjangoForm),
    )

We might need to be extra attentive towards some custom form fields, such as django-colorfield and django-ace, which utilize script tags directly within the form body.

Additionally, some anchor link buttons, such as those within django-crispy-forms, may require special attention as well. For example, should we automatically use reactpy_router to intercept these links? This automatic behavior might need to be a configurable setting within the component.

@Archmonger Archmonger added triage and removed triage labels Jan 9, 2022
@Archmonger Archmonger changed the title Django Forms integration DjangoForm Component Jun 29, 2022
@Archmonger Archmonger changed the title DjangoForm Component Django form Component Aug 17, 2022
@Archmonger Archmonger changed the title Django form Component Django form component Dec 30, 2022
@Archmonger Archmonger changed the title Django form component django_form component Jan 16, 2023
@Archmonger Archmonger linked a pull request Jan 11, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant