Created
September 23, 2010 07:15
-
-
Save lehmannro/593270 to your computer and use it in GitHub Desktop.
HTML5 placeholder for Django forms
This file contains hidden or 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.forms.forms import BoundField | |
boundfield_as_widget = BoundField.as_widget | |
def as_widget(self, widget=None, attrs=None, only_initial=False): | |
if attrs is None: | |
attrs = {} | |
attrs['placeholder'] = self.label | |
return boundfield_as_widget(self, widget=widget, attrs=attrs, | |
only_initial=only_initial) | |
BoundField.as_widget = as_widget |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment