Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #184 Django 1.11 LTS #1

Open
wants to merge 1 commit into
base: django-110
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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