2017-11-21 10 views
0

안녕하세요, 저는 django를 사용하고 있기 때문에 "입력"의 왼쪽에 글리프콘을 추가 할 수 있습니다. 알고 계시면 form.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 :

<form ...> 
    ... 
    <i class="glyphicon..."></> {{ form.field_name }} 
    ... 
</form> 

은 참조 : 당신은 그냥 필드를 렌더링하는 대신 수동처럼, 전체 양식을 렌더링 할 수

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) 
+1

[싱싱 형태] (http://django-crispy-forms.readthedocs.io/ko/latest/)를 사용하십시오. –

+1

https://simpleisbetterthancomplex.com/article/2017/08/19/how-to-render-django-form-manually.html –

+0

@brunodesthuilliers 감사합니다.하지만 글리 옥도 추가 할 수있는 방법을 모르겠습니다. – Beno

답변

1

docs.

+0

음 ... 인터 스팅! 내 문제가 해결 될 것 같아! 나는 그것을 시도 할 것이다! 타아 뱅크스 – Beno