本文介紹 django.forms.Field.label_suffix
的用法。
聲明
Field.label_suffix
label_suffix
參數允許您基於每個字段覆蓋表單的
:label_suffix
>>> class ContactForm(forms.Form):
... age = forms.IntegerField()
... nationality = forms.CharField()
... captcha_answer = forms.IntegerField(label='2 + 2', label_suffix=' =')
>>> f = ContactForm(label_suffix='?')
>>> print(f.as_p())
<p><label for="id_age">Age?</label> <input id="id_age" name="age" type="number" required></p>
<p><label for="id_nationality">Nationality?</label> <input id="id_nationality" name="nationality" type="text" required></p>
<p><label for="id_captcha_answer">2 + 2 =</label> <input id="id_captcha_answer" name="captcha_answer" type="number" required></p>
相關用法
- Python Django Field.label用法及代碼示例
- Python Django Field.description用法及代碼示例
- Python Django Field.type_name用法及代碼示例
- Python Django Field.help_text用法及代碼示例
- Python Django Field.width用法及代碼示例
- Python Django Field.error_messages用法及代碼示例
- Python Django Field.as_datetime用法及代碼示例
- Python Django Field.value用法及代碼示例
- Python Django Field.type用法及代碼示例
- Python Django Field.as_string用法及代碼示例
- Python Django Field.as_int用法及代碼示例
- Python Django Field.default用法及代碼示例
- Python Django Field.as_double用法及代碼示例
- Python Django Field.initial用法及代碼示例
- Python Django Field.name用法及代碼示例
- Python Django Field.precision用法及代碼示例
- Python Django Field.required用法及代碼示例
- Python Django File.save用法及代碼示例
- Python File next()用法及代碼示例
- Python File tell()用法及代碼示例
- Python File seek()用法及代碼示例
- Python OpenCV Filter2D()用法及代碼示例
- Python File writable()用法及代碼示例
- Python File close()用法及代碼示例
- Python Django FileField.upload_to用法及代碼示例
注:本文由純淨天空篩選整理自djangoproject.com大神的英文原創作品 django.forms.Field.label_suffix。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。