mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Refs #25778 -- Updated some links and references to HTTPS.
This commit is contained in:
committed by
Mariusz Felisiak
parent
134cde8415
commit
272ceb9584
@@ -173,13 +173,13 @@ field is initialized to a particular value. For example:
|
||||
>>> from django import forms
|
||||
>>> class CommentForm(forms.Form):
|
||||
... name = forms.CharField(initial="Your name")
|
||||
... url = forms.URLField(initial="http://")
|
||||
... url = forms.URLField(initial="https://")
|
||||
... comment = forms.CharField()
|
||||
...
|
||||
>>> f = CommentForm(auto_id=False)
|
||||
>>> print(f)
|
||||
<div>Name:<input type="text" name="name" value="Your name" required></div>
|
||||
<div>Url:<input type="url" name="url" value="http://" required></div>
|
||||
<div>Url:<input type="url" name="url" value="https://" required></div>
|
||||
<div>Comment:<input type="text" name="comment" required></div>
|
||||
|
||||
You may be thinking, why not just pass a dictionary of the initial values as
|
||||
@@ -193,7 +193,7 @@ and the HTML output will include any validation errors:
|
||||
... url = forms.URLField()
|
||||
... comment = forms.CharField()
|
||||
...
|
||||
>>> default_data = {"name": "Your name", "url": "http://"}
|
||||
>>> default_data = {"name": "Your name", "url": "https://"}
|
||||
>>> f = CommentForm(default_data, auto_id=False)
|
||||
>>> print(f)
|
||||
<div>Name:
|
||||
@@ -201,7 +201,7 @@ and the HTML output will include any validation errors:
|
||||
</div>
|
||||
<div>Url:
|
||||
<ul class="errorlist"><li>Enter a valid URL.</li></ul>
|
||||
<input type="url" name="url" value="http://" required aria-invalid="true">
|
||||
<input type="url" name="url" value="https://" required aria-invalid="true">
|
||||
</div>
|
||||
<div>Comment:
|
||||
<ul class="errorlist"><li>This field is required.</li></ul>
|
||||
@@ -219,7 +219,7 @@ validation if a particular field's value is not given. ``initial`` values are
|
||||
|
||||
>>> class CommentForm(forms.Form):
|
||||
... name = forms.CharField(initial="Your name")
|
||||
... url = forms.URLField(initial="http://")
|
||||
... url = forms.URLField(initial="https://")
|
||||
... comment = forms.CharField()
|
||||
...
|
||||
>>> data = {"name": "", "url": "", "comment": "Foo"}
|
||||
|
||||
Reference in New Issue
Block a user