django-bootstrap-forme este o aplicatie Django care oferă Twitter bootstrap forme Django gata.
Instalare
1. Instalați folosind PIP:
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; PIP instala git -e + git: //github.com/earle/django-bootstrap.git#egg=bootstrap
2. Adauga la INSTALLED_APPS:
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; "Bootstrap",
Utilizare
& Nbsp; & nbsp; & nbsp; de la bootstrap.forms import BootstrapForm, FIELDSET
& Nbsp; & nbsp; & nbsp; LoginForm clasă (BootstrapForm):
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; Clasa de Meta:
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; aspect = (
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; FIELDSET ("Logheaza-te", "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; parola = forms.CharField (widget = forms.PasswordInput (), MAX_LENGTH = 100)
Dacă doriți să utilizați formularul învelișul Bootstrap pe un built-in formă, cum ar fi cele de la `django.contrib.auth.forms` atunci puteți utiliza clasa mixin.
& Nbsp; & nbsp; & nbsp; de la django.contrib.auth.forms PasswordChangeForm import
& Nbsp; & nbsp; & nbsp; de la bootstrap.forms import BootstrapMixin, FIELDSET
& Nbsp; & nbsp; & nbsp; clasă BootstrapPasswordChangeForm (BootstrapMixin, PasswordChangeForm):
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; Clasa de Meta:
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; aspect = (
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; FIELDSET ("Schimbați parola",
"Old_password", "new_password1", "new_password2"),
Când folosiți mixin direct, trebuie să fie prima clasa formularul moștenește de la.
Utilizare șablon
& Nbsp; & nbsp; & nbsp;
Cerințe :
- Python
- Django
Comentariile nu a fost găsit