Skip to content

Commit

Permalink
Fixed #184 Django 1.11 LTS
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tomturner committed Jun 14, 2017
1 parent fec7eb1 commit 55884ec
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions floppyforms/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 55884ec

Please sign in to comment.