添加一个字形图标,即使我使用 Django
Add a glyphicon even if i use Django
你好,我想知道如何在我的代码中的 "input" 左侧添加一个字形图标,因为我使用的是 django,我必须使用 forms.py 你知道的。
我的 HTML 代码:
<form methode="post" action="/connexion" class="form-horizontal" role="form">
{% csrf_token %}
{{ form.as_p }}
<div>
<button type="submit" class="btn btn-info"><span class="glyphicon glyphicon-off">Connexion</button>
</div>
</form>
forms.py :
class ConnexionForm(forms.Form):
user = forms.CharField(label='', max_length=30, widget=forms.TextInput(attrs={'placeholder': "Nom d'utilisateur"}))
password = forms.CharField(label='', widget=forms.PasswordInput)
您可以只手动呈现字段而不是呈现整个表单,例如:
<form ...>
...
<i class="glyphicon..."></> {{ form.field_name }}
...
</form>
参见docs。
你好,我想知道如何在我的代码中的 "input" 左侧添加一个字形图标,因为我使用的是 django,我必须使用 forms.py 你知道的。
我的 HTML 代码:
<form methode="post" action="/connexion" class="form-horizontal" role="form">
{% csrf_token %}
{{ form.as_p }}
<div>
<button type="submit" class="btn btn-info"><span class="glyphicon glyphicon-off">Connexion</button>
</div>
</form>
forms.py :
class ConnexionForm(forms.Form):
user = forms.CharField(label='', max_length=30, widget=forms.TextInput(attrs={'placeholder': "Nom d'utilisateur"}))
password = forms.CharField(label='', widget=forms.PasswordInput)
您可以只手动呈现字段而不是呈现整个表单,例如:
<form ...>
...
<i class="glyphicon..."></> {{ form.field_name }}
...
</form>
参见docs。