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

build_attrs function changed on django 1.11 #67

Open
wants to merge 1 commit into
base: master
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
9 changes: 8 additions & 1 deletion bootstrap3_datetime/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from django.utils import translation
from django.utils.safestring import mark_safe
from django.utils.html import conditional_escape
import django

try:
import json
Expand Down Expand Up @@ -124,7 +125,13 @@ def __init__(self, attrs=None, format=None, options=None, div_attrs=None, icon_a
def render(self, name, value, attrs=None):
if value is None:
value = ''
input_attrs = self.build_attrs(attrs, type=self.input_type, name=name)
if django.VERSION < (1,11):
input_attrs = self.build_attrs(attrs, type=self.input_type, name=name)
else:
base_attrs = {'name': name}
if 'class' in self.attrs:
base_attrs['class'] = self.attrs['class']
input_attrs = self.build_attrs(attrs, base_attrs)
if value != '':
# Only add the 'value' attribute if a value is non-empty.
input_attrs['value'] = force_text(self._format_value(value))
Expand Down