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. 4
      setup.py

2
requirements/requirements.txt

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

16
sapl/utils.py

@ -208,19 +208,27 @@ class RangeWidgetOverride(forms.MultiWidget):
def __init__(self, attrs=None): def __init__(self, attrs=None):
widgets = (forms.DateInput(format='%d/%m/%Y', widgets = (forms.DateInput(format='%d/%m/%Y',
attrs={'class': 'dateinput', attrs={'class': 'dateinput form-control',
'placeholder': 'Inicial'}), 'placeholder': 'Inicial'}),
forms.DateInput(format='%d/%m/%Y', forms.DateInput(format='%d/%m/%Y',
attrs={'class': 'dateinput', attrs={'class': 'dateinput form-control',
'placeholder': 'Final'})) 'placeholder': 'Final'}))
super(RangeWidgetOverride, self).__init__(widgets, attrs) super(RangeWidgetOverride, self).__init__(widgets, attrs)
def decompress(self, value): def decompress(self, value):
if value: if value:
return [value.start, value.stop] 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>'\ html = '<div class="col-sm-6">%s</div><div class="col-sm-6">%s</div>'\
% tuple(rendered_widgets) % tuple(rendered_widgets)
return '<div class="row">%s</div>' % html return '<div class="row">%s</div>' % html

4
setup.py

@ -17,8 +17,8 @@ install_requires = [
'dj-database-url==0.5.0', 'dj-database-url==0.5.0',
'django-bower==5.2.0', 'django-bower==5.2.0',
'django-braces==1.9.0', 'django-braces==1.9.0',
'django-crispy-forms==1.7.2',
'django-crispy-forms==1.6.1',
'django-extensions==1.9.8', 'django-extensions==1.9.8',
'django-extra-views==0.11.0', 'django-extra-views==0.11.0',
'django-floppyforms==1.6.2', 'django-floppyforms==1.6.2',
@ -46,7 +46,7 @@ install_requires = [
# 'git+git://github.com/interlegis/trml2pdf.git', # 'git+git://github.com/interlegis/trml2pdf.git',
# 'git+git://github.com/jasperlittle/django-rest-framework-docs' # 'git+git://github.com/jasperlittle/django-rest-framework-docs'
# 'git+git://github.com/rubgombar1/django-admin-bootstrapped.git'' # 'git+git://github.com/rubgombar1/django-admin-bootstrapped.git''
#'django-compressor==2.2', #'django-compressor==2.2',
] ]
setup( setup(

Loading…
Cancel
Save