-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8b4ec0
commit 5596d8d
Showing
43 changed files
with
1,664 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{% load django_bootstrap5 %} | ||
|
||
<!-- Note: CSS/JS is loaded here only for demonstration purposes. | ||
You should load this CSS/JS in your HTML <head> instead. --> | ||
{% bootstrap_css %} | ||
{% bootstrap_javascript %} | ||
|
||
<!-- The actual form that is rendered by ReactPy --> | ||
{% bootstrap_form form %} | ||
{% bootstrap_button button_type="submit" content="OK" %} | ||
{% bootstrap_button button_type="reset" content="Reset" %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from reactpy import component, html | ||
|
||
from example.forms import MyForm | ||
from reactpy_django.components import django_form | ||
|
||
|
||
@component | ||
def basic_form(): | ||
children = [html.input({"type": "submit"})] | ||
return django_form(MyForm, bottom_children=children) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from reactpy import component | ||
|
||
from example.forms import MyForm | ||
from reactpy_django.components import django_form | ||
|
||
|
||
@component | ||
def basic_form(): | ||
return django_form(MyForm, form_template="bootstrap_form.html") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django import forms | ||
|
||
|
||
class MyForm(forms.Form): | ||
username = forms.CharField(label="Username") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from reactpy import component, hooks, html | ||
from reactpy_router import navigate | ||
|
||
from example.forms import MyForm | ||
from reactpy_django.components import django_form | ||
from reactpy_django.types import FormEventData | ||
|
||
|
||
@component | ||
def basic_form(): | ||
submitted, set_submitted = hooks.use_state(False) | ||
|
||
def on_submit(event: FormEventData): | ||
"""This function will be called when the form is successfully submitted.""" | ||
set_submitted(True) | ||
|
||
if submitted: | ||
return navigate("/homepage") | ||
|
||
children = [html.input({"type": "submit"})] | ||
return django_form(MyForm, on_success=on_submit, bottom_children=children) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from django import forms | ||
|
||
|
||
class MyForm(forms.Form): ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,3 +48,4 @@ linter | |
linters | ||
linting | ||
formatters | ||
bootstrap_form |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.