##// END OF EJS Templates
Add power monitor
Add power monitor

File last commit:

r368:c3e97504a5df
r393:737695221ef9
Show More
forms.py
151 lines | 5.8 KiB | text/x-python | PythonLexer
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2 from django import forms
Juan C. Espinoza
Updating base models and views ...
r6 from django.utils.safestring import mark_safe
Clean code and update Pedestal model
r368 from apps.main.models import Device, Experiment, Configuration
Juan C. Espinoza
Add Change IP function for DDS Device...
r219 from django.template.defaultfilters import default
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2
Miguel Urco
DDS commands working...
r57 FILE_FORMAT = (
('json', 'json'),
)
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2 def add_empty_choice(choices, pos=0, label='-----'):
if len(choices)>0:
choices = list(choices)
choices.insert(0, (0, label))
return choices
else:
return [(0, label)]
Juan C. Espinoza
Updating base models and views ...
r6 class DatepickerWidget(forms.widgets.TextInput):
Nueva plantilla, prueba comunicacion y nuevos campos ddsrest
r335 def render(self, name, value, attrs=None, renderer=None):
Juan C. Espinoza
Updating base models and views ...
r6 input_html = super(DatepickerWidget, self).render(name, value, attrs)
Nueva plantilla, prueba comunicacion y nuevos campos ddsrest
r335
html = '<div class="input-group date">'+input_html+'<span class="input-group-addon"><i class="far fa-calendar-alt"></i></span></div>'
Juan C. Espinoza
Updating base models and views ...
r6 return mark_safe(html)
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 class DateRangepickerWidget(forms.widgets.TextInput):
Nueva plantilla, prueba comunicacion y nuevos campos ddsrest
r335 def render(self, name, value, attrs=None, renderer=None):
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 start = attrs['start_date']
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 end = attrs['end_date']
Juan C. Espinoza
Add scheduler for campaigns/experiments using celery #718, fix views and models bugs...
r196 html = '''<div class="col-md-6 input-group date" style="float:inherit">
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 <input class="form-control" id="id_start_date" name="start_date" placeholder="Start" title="" type="text" value="{}">
Nueva plantilla, prueba comunicacion y nuevos campos ddsrest
r335 <span class="input-group-addon"><i class="far fa-calendar-alt"></i></span>
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 </div>
Juan C. Espinoza
Add scheduler for campaigns/experiments using celery #718, fix views and models bugs...
r196 <div class="col-md-6 input-group date" style="float:inherit">
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 <input class="form-control" id="id_end_date" name="end_date" placeholder="End" title="" type="text" value="{}">
Nueva plantilla, prueba comunicacion y nuevos campos ddsrest
r335 <span class="input-group-addon"><i class="far fa-calendar-alt"></i></span>
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 </div>'''.format(start, end)
return mark_safe(html)
Miguel Urco
Campaign has been added to RadarSys Model...
r13 class TimepickerWidget(forms.widgets.TextInput):
Nueva plantilla, prueba comunicacion y nuevos campos ddsrest
r335 def render(self, name, value, attrs=None, renderer=None):
Miguel Urco
Campaign has been added to RadarSys Model...
r13 input_html = super(TimepickerWidget, self).render(name, value, attrs)
Nueva plantilla, prueba comunicacion y nuevos campos ddsrest
r335
html = '<div class="input-group time">'+input_html+'<span class="input-group-addon"><i class="far fa-clock"></i></span></div>'
Miguel Urco
Campaign has been added to RadarSys Model...
r13 return mark_safe(html)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Campaign has been added to RadarSys Model...
r13 class ExperimentForm(forms.ModelForm):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Campaign has been added to RadarSys Model...
r13 def __init__(self, *args, **kwargs):
super(ExperimentForm, self).__init__(*args, **kwargs)
experiment menu edition
r358 #self.fields['start_time'].widget = TimepickerWidget(self.fields['start_time'].widget.attrs)
#self.fields['end_time'].widget = TimepickerWidget(self.fields['end_time'].widget.attrs)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
Update Views y several improvements
r316 def save(self, *args, **kwargs):
gonzalesluisfrancisco
Version con fecha de campanhas corregida pero falta lanzar las tareas e celery rev2
r343 exp = super(ExperimentForm, self).save(*args, **kwargs)
Fiorella Quino
Main files have been updated...
r266 exp.name = exp.name.replace(' ', '')
exp.save()
return exp
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2 class Meta:
model = Experiment
Juan C. Espinoza
Update Views y several improvements
r316 exclude = ['task', 'status', 'author', 'hash']
New experiment views
r360
class ExperimentEditionForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(ExperimentEditionForm, self).__init__(*args, **kwargs)
#self.fields['start_time'].widget = TimepickerWidget(self.fields['start_time'].widget.attrs)
#self.fields['end_time'].widget = TimepickerWidget(self.fields['end_time'].widget.attrs)
def save(self, *args, **kwargs):
exp = super(ExperimentEditionForm, self).save(*args, **kwargs)
exp.name = exp.name.replace(' ', '')
exp.save()
return exp
class Meta:
model = Experiment
Experiment views update
r364 exclude = ['pedestal', 'generator', 'reception_rx', 'transmission_tx', 'task', 'status', 'author', 'hash']
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Campaign has been added to RadarSys Model...
r13 class DeviceForm(forms.ModelForm):
Juan C. Espinoza
Updating base models and views ...
r6 class Meta:
model = Device
exclude = ['status']
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2
Miguel Urco
Campaign has been added to RadarSys Model...
r13 class ConfigurationForm(forms.ModelForm):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
Update several views and models in main app...
r85 def __init__(self, *args, **kwargs):
super(ConfigurationForm, self).__init__(*args, **kwargs)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
Update several views and models in main app...
r85 if 'initial' in kwargs and 'experiment' in kwargs['initial'] and kwargs['initial']['experiment'] not in (0, '0'):
self.fields['experiment'].widget.attrs['disabled'] = 'disabled'
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Campaign has been added to RadarSys Model...
r13 class Meta:
model = Configuration
Juan C. Espinoza
Update Views y several improvements
r316 exclude = ['type', 'created_date', 'programmed_date', 'parameters', 'author', 'hash']
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Models changed:...
r53 class UploadFileForm(forms.Form):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Models changed:...
r53 file = forms.FileField()
Miguel Urco
DDS commands working...
r57
Miguel Urco
Models changed:...
r53 class DownloadFileForm(forms.Form):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
DDS commands working...
r57 format = forms.ChoiceField(choices= ((0, 'json'),) )
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
DDS commands working...
r57 def __init__(self, device_type, *args, **kwargs):
New experiment views
r360
Miguel Urco
DDS commands working...
r57 super(DownloadFileForm, self).__init__(*args, **kwargs)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
DDS commands working...
r57 self.fields['format'].choices = FILE_FORMAT
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138
Juan C. Espinoza
Update several views and models in main app...
r85 class NewForm(forms.Form):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Clean code and update Pedestal model
r368 # create_from = forms.ChoiceField(choices=((0, '-----'),
# (1, 'Empty (blank)'),
# (2, 'Template')))
# choose_template = forms.ChoiceField()
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
Update several views and models in main app...
r85 def __init__(self, *args, **kwargs):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Clean code and update Pedestal model
r368 #template_choices = kwargs.pop('template_choices', [])
Juan C. Espinoza
Update several views and models in main app...
r85 super(NewForm, self).__init__(*args, **kwargs)
Clean code and update Pedestal model
r368 #self.fields['choose_template'].choices = add_empty_choice(template_choices)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138
class FilterForm(forms.Form):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 def __init__(self, *args, **kwargs):
extra_fields = kwargs.pop('extra_fields', [])
super(FilterForm, self).__init__(*args, **kwargs)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
for field in extra_fields:
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 if 'range_date' in field:
self.fields[field] = forms.CharField(required=False)
self.fields[field].widget = DateRangepickerWidget()
if 'initial' in kwargs:
self.fields[field].widget.attrs = {'start_date':kwargs['initial'].get('start_date', ''),
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 'end_date':kwargs['initial'].get('end_date', '')}
Clean code and update Pedestal model
r368 elif field in ('historical', ) or 'my ' in field:
Juan C. Espinoza
Improve operation & search views
r306 self.fields[field] = forms.BooleanField(required=False)
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 else:
self.fields[field] = forms.CharField(required=False)
Juan C. Espinoza
Add Change IP function for DDS Device...
r219
class ChangeIpForm(forms.Form):
Fiorella Quino
Main files have been updated...
r266
Juan C. Espinoza
Add Change IP function for DDS Device...
r219 ip_address = forms.GenericIPAddressField()
gonzalesluisfrancisco
Version con fecha de campanhas corregida pero falta lanzar las tareas e celery rev2
r343 mask = forms.GenericIPAddressField(initial='255.255.255.0')
gateway = forms.GenericIPAddressField(initial='0.0.0.0')
dns = forms.GenericIPAddressField(initial='0.0.0.0')