Browse Source

bump django-crispy-forms e ajustes de código

pull/2446/head
Leandro Roberto 6 years ago
parent
commit
22b87f36eb
  1. 2
      requirements/requirements.txt
  2. 16
      sapl/utils.py
  3. 2
      setup.py

2
requirements/requirements.txt

@ -6,8 +6,8 @@ djangorestframework==3.9.0
dj-database-url==0.5.0
django-bower==5.2.0
django-braces==1.9.0
django-crispy-forms==1.7.2
django-crispy-forms==1.6.1
django-extensions==1.9.8
django-extra-views==0.11.0
django-floppyforms==1.6.2

16
sapl/utils.py

@ -208,19 +208,27 @@ class RangeWidgetOverride(forms.MultiWidget):
def __init__(self, attrs=None):
widgets = (forms.DateInput(format='%d/%m/%Y',
attrs={'class': 'dateinput',
attrs={'class': 'dateinput form-control',
'placeholder': 'Inicial'}),
forms.DateInput(format='%d/%m/%Y',
attrs={'class': 'dateinput',
attrs={'class': 'dateinput form-control',
'placeholder': 'Final'}))
super(RangeWidgetOverride, self).__init__(widgets, attrs)
def decompress(self, value):
if value:
return [value.start, value.stop]
return [None, None]
return []
def render(self, name, value, attrs=None, renderer=None):
rendered_widgets = []
for i, x in enumerate(self.widgets):
rendered_widgets.append(
x.render(
'%s_%d' % (name, i), value[i] if value else ''
)
)
def format_output(self, rendered_widgets):
html = '<div class="col-sm-6">%s</div><div class="col-sm-6">%s</div>'\
% tuple(rendered_widgets)
return '<div class="row">%s</div>' % html

2
setup.py

@ -17,8 +17,8 @@ install_requires = [
'dj-database-url==0.5.0',
'django-bower==5.2.0',
'django-braces==1.9.0',
'django-crispy-forms==1.7.2',
'django-crispy-forms==1.6.1',
'django-extensions==1.9.8',
'django-extra-views==0.11.0',
'django-floppyforms==1.6.2',

Loading…
Cancel
Save