django-bootstrap-forme è un app Django che fornisce Twitter bootstrap forme Django pronti.
Installazione
1. Installare utilizzando pip:
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; pip installare git -e + git: //github.com/earle/django-bootstrap.git#egg=bootstrap
2. Aggiungere a INSTALLED_APPS:
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; 'Bootstrap',
Utilizzo
& Nbsp; & nbsp; & nbsp; da bootstrap.forms importare BootstrapForm, Fieldset
& Nbsp; & nbsp; & nbsp; LoginForm class (BootstrapForm):
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; Classe Meta:
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; layout = (
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; Fieldset ("Effettua il Login", "username", "password",),
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; )
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; username = forms.CharField (max_length = 100)
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; password = forms.CharField (widget di = forms.PasswordInput (), max_length = 100)
Se si desidera utilizzare il modulo involucro Bootstrap su un built-in forma, come quelle in `django.contrib.auth.forms` quindi è possibile utilizzare la classe intermedia.
& Nbsp; & nbsp; & nbsp; da django.contrib.auth.forms import PasswordChangeForm
& Nbsp; & nbsp; & nbsp; da bootstrap.forms importare BootstrapMixin, Fieldset
& Nbsp; & nbsp; & nbsp; Classe BootstrapPasswordChangeForm (BootstrapMixin, PasswordChangeForm):
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; Classe Meta:
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; layout = (
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; Fieldset ("Cambia la tua password",
"Old_password", "new_password1", "new_password2"),
Quando si utilizza il mixin direttamente deve essere la prima della classe il modulo eredita da.
Template Uso
& Nbsp; & nbsp; & nbsp;
Requisiti :
- Python
- Django
I commenti non trovato