From 55884ec6374e074f1cf470a95fe08f775037baa3 Mon Sep 17 00:00:00 2001 From: Thomas Turner Date: Wed, 14 Jun 2017 14:42:19 +0100 Subject: [PATCH] Fixed #184 Django 1.11 LTS I know that Django 1.11 has D-FF built in. However I and many other require a tranistion build of D-FF. This commit does this --- floppyforms/widgets.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/floppyforms/widgets.py b/floppyforms/widgets.py index c890a6e..5b8cddc 100644 --- a/floppyforms/widgets.py +++ b/floppyforms/widgets.py @@ -45,6 +45,23 @@ class Widget(forms.Widget): def is_hidden(self): return self.input_type == 'hidden' if hasattr(self, 'input_type') else False + def render(self, name, value, attrs=None): + """ + Returns this Widget rendered as HTML, as a Unicode string. + The 'value' given is not guaranteed to be valid input, so subclass + implementations should program defensively. + """ + raise NotImplementedError('subclasses of Widget must provide a render() method') + + def build_attrs(self, extra_attrs=None, **kwargs): + """ + Backported from Django 1.10 + Helper function for building an attribute dictionary. + """ + attrs = dict(self.attrs, **kwargs) + if extra_attrs: + attrs.update(extra_attrs) + return attrs class Input(Widget): template_name = 'floppyforms/input.html'