From a7a35ca3c147c717529f467f245902e38398370a Mon Sep 17 00:00:00 2001 From: Daniel Ryan Date: Mon, 15 Sep 2014 11:12:25 -0400 Subject: [PATCH] add form-control class to widget_html --- rest_framework/fields.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rest_framework/fields.py b/rest_framework/fields.py index c0253f86b..779f050e4 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -162,6 +162,10 @@ class Field(object): attrs = {} if 'id' not in self.widget.attrs: attrs['id'] = self._name + if not 'class' in self.widget.attrs: + attrs['class'] = 'form-control' + elif attrs['class'].find('form-control') == -1: + attrs['class'] += ' form-control' return self.widget.render(self._name, self._value, attrs=attrs)