Skip to content

Instantly share code, notes, and snippets.

@bmispelon
bmispelon / placeholderify.py
Created April 27, 2015 22:03
Automatic placeholder attributes from field labels in Django forms
from functools import partial
def placeholderify(form=None, fields=None):
"""
A decorator for Django forms that sets a `placeholder` attribute to all
fields. Each field's label is used as a placeholder.
Use it like so: