-
-
Notifications
You must be signed in to change notification settings - Fork 80
Added support for Django 5.2. #200
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
Changes from 1 commit
d5ba6ec
979a879
e9a5108
d3bfd7e
0ba1185
42d5f20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<form method="post"> | ||
<div class=" col-md"> | ||
<div class="mb-3"><label class=" form-label requiredField" for="id_email">Email<span | ||
class="asteriskField">*</span></label> | ||
<div> | ||
<div class="input-group"><input class="form-control inputtext is-invalid textInput textinput" | ||
id="id_email" maxlength="20" name="email" required type="text" aria-invalid="true"><button | ||
class="btn btn-outline-secondary" type="button">Go!</button></div> | ||
<p class="mb-0 text-danger" id="error_1_id_email"><small><strong>This field is | ||
required.</strong></small></p> | ||
</div> | ||
</div> | ||
</div> | ||
</form> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<form method="post" enctype="multipart/form-data"> | ||
<div id="div_id_clearable_file" class="mb-3"> | ||
<label for="id_clearable_file" class="form-label requiredField"> | ||
Clearable file | ||
<span class="asteriskField">*</span> | ||
</label> | ||
<div class="is-invalid"> | ||
<input | ||
type="file" | ||
name="clearable_file" | ||
class="form-control is-invalid" | ||
id="id_clearable_file" | ||
required | ||
aria-invalid="true" | ||
> | ||
<span id="error_1_id_clearable_file" class="invalid-feedback"> | ||
<strong>This field is required.</strong> | ||
</span> | ||
</div> | ||
</div> | ||
</form> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<form method="post" enctype="multipart/form-data"> | ||
<div id="div_id_file_field" class="mb-3"> | ||
<label for="id_file_field" class="form-label requiredField"> | ||
File field | ||
<span class="asteriskField">*</span> | ||
</label> | ||
<div class="is-invalid"> | ||
<input | ||
type="file" | ||
name="file_field" | ||
class="form-control is-invalid" | ||
id="id_file_field" | ||
required | ||
aria-invalid="true" | ||
> | ||
<span id="error_1_id_file_field" class="invalid-feedback"> | ||
<strong>This field is required.</strong> | ||
</span> | ||
</div> | ||
</div> | ||
</form> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<form method="post" > | ||
<div id="div_id_text_area" class="form-floating mb-3"> | ||
<textarea name="text_area" cols="40" rows="10" placeholder="text_area" class="textarea form-control is-invalid" required id="id_text_area" aria-invalid="true"> | ||
</textarea> | ||
<label for="id_text_area"> | ||
Text area<span class="asteriskField">*</span> | ||
</label> | ||
<span id="error_1_id_text_area" class="invalid-feedback"> | ||
<strong>This field is required.</strong> | ||
</span> | ||
</div> | ||
<div id="div_id_select_input" class="form-floating mb-3"> | ||
<select name="select_input" placeholder="select_input" class="select form-select is-invalid" id="id_select_input" aria-invalid="true"> | ||
<option value="1">Option one</option> | ||
<option value="2">Option two</option> | ||
<option value="3">Option three</option> | ||
</select> | ||
<label for="id_select_input"> | ||
Select input<span class="asteriskField">*</span> | ||
</label> | ||
<span id="error_1_id_select_input" class="invalid-feedback"> | ||
<strong>This field is required.</strong> | ||
</span> | ||
</div> | ||
</form> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<form class="form-horizontal" method="post"> | ||
<div id="div_id_is_company" class="mb-3 form-check form-switch row"> | ||
<div class="offset-lg-2 col-lg-8"> | ||
<input type="checkbox" name="is_company" class="checkboxinput form-check-input" role="checkbox" id="id_is_company" /> | ||
<input type="checkbox" aria-describedby="id_is_company_helptext" name="is_company" class="checkboxinput form-check-input" role="checkbox" id="id_is_company" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is a bit odd. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bisected to django/django@1e05431 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previous to django/django@1e05431 Django looked at the field's help text ( form["is_company"].help_text = "is_company help text" Rather than when setting the field on the form: class MyForm(forms.Form):
my_field = forms.CharField(help_text="...", ...) I think, that's ok as we would expect help text to be referenced with an @sarahboyce -- sorry for the ping. I spotted this change, and would appreciate your thought with your fellow hat on. I think it's likely ok but wondered if you could give a second opinion on if we need to do anything further at django/django for this behaviour change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think this is now more correct. |
||
<label for="id_is_company" class="form-check-label">company</label> | ||
<div id="id_is_company_helptext" class="form-text">is_company help text</div> | ||
</div> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<form class="form-horizontal" method="post"> | ||
<div id="div_id_is_company" class="mb-3 form-check form-switch row"> | ||
<div class="offset-lg-2 col-lg-8"> | ||
<input type="checkbox" name="is_company" class="checkboxinput form-check-input" role="checkbox" id="id_is_company" /> | ||
<label for="id_is_company" class="form-check-label">company</label> | ||
<div id="id_is_company_helptext" class="form-text">is_company help text</div> | ||
</div> | ||
</div> | ||
<div id="div_id_first_name" class="mb-3 row"> | ||
<label for="id_first_name" class="col-form-label col-lg-2 pt-0 requiredField">first name<span class="asteriskField">*</span> </label> | ||
<div class="col-lg-8"><input type="text" name="first_name" maxlength="5" class="textinput textInput inputtext form-control" required id="id_first_name" /></div> | ||
</div> | ||
</form> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<form method="post"> | ||
<div id="div_id_is_company" class="mb-3 form-check form-switch"> | ||
<div class=""> | ||
<input type="checkbox" name="is_company" class="checkboxinput form-check-input" role="checkbox" id="id_is_company" /> | ||
<label for="id_is_company" class="form-check-label">company</label> | ||
<div id="id_is_company_helptext" class="form-text">is_company help text</div> | ||
</div> | ||
</div> | ||
</form> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<form method="post"> | ||
<div><input id="id_form-TOTAL_FORMS" name="form-TOTAL_FORMS" type="hidden" value="1"><input | ||
id="id_form-INITIAL_FORMS" name="form-INITIAL_FORMS" type="hidden" value="0"><input | ||
id="id_form-MIN_NUM_FORMS" name="form-MIN_NUM_FORMS" type="hidden"><input id="id_form-MAX_NUM_FORMS" | ||
name="form-MAX_NUM_FORMS" type="hidden"></div> | ||
<table class="table table-sm table-striped"> | ||
<thead> | ||
<tr> | ||
<th class="" for="id_form-0-is_company">company</th> | ||
<th class="requiredField" for="id_form-0-email">email<span class="asteriskField">*</span> | ||
</th> | ||
<th class="requiredField" for="id_form-0-password1">password<span | ||
class="asteriskField">*</span></th> | ||
<th class="requiredField" for="id_form-0-password2">re-enter password<span | ||
class="asteriskField">*</span></th> | ||
<th class="requiredField" for="id_form-0-first_name">first name<span | ||
class="asteriskField">*</span></th> | ||
<th class="requiredField" for="id_form-0-last_name">last name<span | ||
class="asteriskField">*</span></th> | ||
<th class="requiredField" for="id_form-0-datetime_field">date time<span | ||
class="asteriskField">*</span></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr class="d-none empty-form"> | ||
<td class="mb-3" id="div_id_form-__prefix__-is_company"><input | ||
class="checkboxinput form-check-input" id="id_form-__prefix__-is_company" | ||
name="form-__prefix__-is_company" type="checkbox"></td> | ||
<td class="mb-3" id="div_id_form-__prefix__-email"><input | ||
class="form-control inputtext textInput textinput" id="id_form-__prefix__-email" maxlength="30" | ||
name="form-__prefix__-email" type="text" aria-describedby="id_form-__prefix__-email_helptext"> | ||
<div class="form-text" id="id_form-__prefix__-email_helptext">Insert your email</div></td> | ||
<td class="mb-3" id="div_id_form-__prefix__-password1"><input class="form-control textInput textinput" | ||
id="id_form-__prefix__-password1" maxlength="30" name="form-__prefix__-password1" | ||
type="password"></td> | ||
<td class="mb-3" id="div_id_form-__prefix__-password2"><input class="form-control textInput textinput" | ||
id="id_form-__prefix__-password2" maxlength="30" name="form-__prefix__-password2" | ||
type="password"></td> | ||
<td class="mb-3" id="div_id_form-__prefix__-first_name"><input | ||
class="form-control inputtext textInput textinput" id="id_form-__prefix__-first_name" | ||
maxlength="5" name="form-__prefix__-first_name" type="text"></td> | ||
<td class="mb-3" id="div_id_form-__prefix__-last_name"><input | ||
class="form-control inputtext textInput textinput" id="id_form-__prefix__-last_name" | ||
maxlength="5" name="form-__prefix__-last_name" type="text"></td> | ||
<td class="mb-3" id="div_id_form-__prefix__-datetime_field"><input class="dateinput form-control" | ||
id="id_form-__prefix__-datetime_field_0" name="form-__prefix__-datetime_field_0" | ||
type="text"><input class="form-control timeinput" id="id_form-__prefix__-datetime_field_1" | ||
name="form-__prefix__-datetime_field_1" type="text"></td> | ||
</tr> | ||
<div class="alert alert-block alert-danger"> | ||
<ul class="m-0"> | ||
<li>Passwords dont match</li> | ||
</ul> | ||
</div> | ||
<tr> | ||
<td class="mb-3" id="div_id_form-0-is_company"><input class="checkboxinput form-check-input" | ||
id="id_form-0-is_company" name="form-0-is_company" type="checkbox"></td> | ||
<td class="mb-3" id="div_id_form-0-email"><input aria-describedby="id_form-0-email_helptext" | ||
class="form-control inputtext is-invalid textInput textinput" id="id_form-0-email" aria-invalid="true" | ||
maxlength="30" name="form-0-email" type="text"><span class="invalid-feedback" | ||
id="error_1_id_form-0-email"><strong>This field is required.</strong></span><div | ||
class="form-text" id="id_form-0-email_helptext">Insert your email</div></td> | ||
<td class="mb-3" id="div_id_form-0-password1"><input class="form-control is-invalid textInput textinput" | ||
id="id_form-0-password1" maxlength="30" name="form-0-password1" type="password" aria-invalid="true"><span | ||
class="invalid-feedback" id="error_1_id_form-0-password1"><strong>This field is | ||
required.</strong></span></td> | ||
<td class="mb-3" id="div_id_form-0-password2"><input class="form-control is-invalid textInput textinput" | ||
id="id_form-0-password2" maxlength="30" name="form-0-password2" type="password" aria-invalid="true"><span | ||
class="invalid-feedback" id="error_1_id_form-0-password2"><strong>This field is | ||
required.</strong></span></td> | ||
<td class="mb-3" id="div_id_form-0-first_name"><input | ||
class="form-control inputtext is-invalid textInput textinput" id="id_form-0-first_name" | ||
maxlength="5" name="form-0-first_name" type="text" aria-invalid="true"><span class="invalid-feedback" | ||
id="error_1_id_form-0-first_name"><strong>This field is required.</strong></span></td> | ||
<td class="mb-3" id="div_id_form-0-last_name"><input | ||
class="form-control inputtext is-invalid textInput textinput" id="id_form-0-last_name" | ||
maxlength="5" name="form-0-last_name" type="text" aria-invalid="true"><span class="invalid-feedback" | ||
id="error_1_id_form-0-last_name"><strong>This field is required.</strong></span></td> | ||
<td class="mb-3" id="div_id_form-0-datetime_field"><input class="dateinput form-control is-invalid" | ||
id="id_form-0-datetime_field_0" name="form-0-datetime_field_0" type="text" aria-invalid="true"><input | ||
class="form-control is-invalid timeinput" id="id_form-0-datetime_field_1" | ||
name="form-0-datetime_field_1" type="text" aria-invalid="true"><span class="invalid-feedback" | ||
id="error_1_id_form-0-datetime_field"><strong>This field is required.</strong></span></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</form> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These ones adding references to errors I'm happy with. That was a new feature in 5.2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/django-crispy-forms/crispy-bootstrap5/blob/main/crispy_bootstrap5/templates/bootstrap5/layout/field_errors.html This (and the block version) will need updating so that the new
aria-describedby
has a target to reference.See error when testing with the 'wave' accessibility checker: