Created
January 16, 2015 16:53
-
-
Save gileno/ce32baa8865b901575e1 to your computer and use it in GitHub Desktop.
Alterando atributos do widget no Form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django import forms | |
class MeuForm(forms.Form): | |
campo1 = forms.CharField(label="Campo 1") | |
def __init__(self, *args, **kwargs): | |
super(MeuForm, self).__init__(*args, **kwargs) | |
self.fields["campo1"].widget.attrs["class"] = "classe_css1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment