##// END OF EJS Templates

File last commit:

r311:6467cbbb1e89
r314:8d83194b6bd7 merge
Show More
forms.py
202 lines | 7.3 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
Fiorella Quino
Main files have been updated...
r266 from apps.main.models import Device, Experiment, Campaign, Location, 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'),
)
DDS_FILE_FORMAT = (
('json', 'json'),
('text', 'dds')
)
RC_FILE_FORMAT = (
('json', 'json'),
Juan C. Espinoza
- Update rc app...
r79 ('text', 'racp'),
('binary', 'dat'),
Miguel Urco
DDS commands working...
r57 )
Fiorella Quino
Task #1068: Export racp and jars files function has been implemented...
r276 JARS_FILE_FORMAT = (
('json', 'json'),
('racp', 'racp'),
('text', 'jars'),
)
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):
def render(self, name, value, attrs=None):
input_html = super(DatepickerWidget, self).render(name, value, attrs)
html = '<div class="input-group date">'+input_html+'<span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span></div>'
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):
def render(self, name, value, attrs=None):
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="{}">
<span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span>
</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="{}">
<span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span>
</div>'''.format(start, end)
return mark_safe(html)
Miguel Urco
Campaign has been added to RadarSys Model...
r13 class TimepickerWidget(forms.widgets.TextInput):
def render(self, name, value, attrs=None):
input_html = super(TimepickerWidget, self).render(name, value, attrs)
html = '<div class="input-group time">'+input_html+'<span class="input-group-addon"><i class="glyphicon glyphicon-time"></i></span></div>'
return mark_safe(html)
class CampaignForm(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 experiments = forms.ModelMultipleChoiceField(widget=forms.CheckboxSelectMultiple(),
queryset=Experiment.objects.filter(template=True),
required=False)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
Updating base models and views ...
r6 def __init__(self, *args, **kwargs):
Miguel Urco
Campaign has been added to RadarSys Model...
r13 super(CampaignForm, self).__init__(*args, **kwargs)
Juan C. Espinoza
Updating base models and views ...
r6 self.fields['start_date'].widget = DatepickerWidget(self.fields['start_date'].widget.attrs)
self.fields['end_date'].widget = DatepickerWidget(self.fields['end_date'].widget.attrs)
Juan C. Espinoza
Update several views and models in main app...
r85 self.fields['description'].widget.attrs = {'rows': 2}
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 if self.instance.pk:
Juan C. Espinoza
Update new and edit "views"...
r91 self.fields['experiments'].queryset |= self.instance.experiments.all()
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 = Campaign
Miguel Urco
template attribute added to RadarSys Models...
r47 exclude = ['']
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)
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
Fiorella Quino
Main files have been updated...
r266 def save(self):
exp = super(ExperimentForm, self).save()
exp.name = exp.name.replace(' ', '')
exp.save()
return exp
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2 class Meta:
model = Experiment
Fix mix experiment and scheduler
r311 exclude = ['task', 'status']
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2
Miguel Urco
Location model added to RadarSys...
r41 class LocationForm(forms.ModelForm):
class Meta:
model = Location
exclude = ['']
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
Miguel Urco
template attribute added to RadarSys Models...
r47 exclude = ['type', 'created_date', 'programmed_date', 'parameters']
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):
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 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
Miguel Urco
DDS commands working...
r57 if device_type == 'dds':
self.fields['format'].choices = DDS_FILE_FORMAT
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 if device_type == 'rc':
self.fields['format'].choices = RC_FILE_FORMAT
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #1068: Export racp and jars files function has been implemented...
r276 if device_type == 'jars':
self.fields['format'].choices = JARS_FILE_FORMAT
Fiorella Quino
Task #487: Vista de Operacion...
r50 class OperationForm(forms.Form):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #487: Operation View. Se puede seleccionar una de las 5 ultimas Campañas o se puede buscar entre todas las existentes....
r69 campaign = forms.ChoiceField(label="Campaign")
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #487: Operation View. Se puede seleccionar una de las 5 ultimas Campañas o se puede buscar entre todas las existentes....
r69 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
campaigns = kwargs.pop('campaigns')
Fiorella Quino
Task #487: Operation View. Se puede seleccionar una de las 5 ultimas Campañas o se puede buscar entre todas las existentes....
r69 super(OperationForm, self).__init__(*args, **kwargs)
Juan C. Espinoza
Add scheduler for campaigns/experiments using celery #718, fix views and models bugs...
r196 self.fields['campaign'].label = 'Current Campaigns'
self.fields['campaign'].choices = add_empty_choice(campaigns.values_list('id', 'name'))
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
Fiorella Quino
Task #487: Operation View. Se puede seleccionar una de las 5 ultimas Campañas o se puede buscar entre todas las existentes....
r69 class OperationSearchForm(forms.Form):
# -----ALL Campaigns------
campaign = forms.ChoiceField(label="Campaign")
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #487: Operation View. Se puede seleccionar una de las 5 ultimas Campañas o se puede buscar entre todas las existentes....
r69 def __init__(self, *args, **kwargs):
super(OperationSearchForm, self).__init__(*args, **kwargs)
self.fields['campaign'].choices=Campaign.objects.all().order_by('-start_date').values_list('id', 'name')
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
Juan C. Espinoza
Update several views and models in main app...
r85 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
Juan C. Espinoza
Update several views and models in main app...
r85 template_choices = kwargs.pop('template_choices', [])
super(NewForm, self).__init__(*args, **kwargs)
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', '')}
Juan C. Espinoza
Improve operation & search views
r306 elif field in ('template', 'historical'):
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()
mask = forms.GenericIPAddressField(initial='255.255.255.0')
gateway = forms.GenericIPAddressField(initial='0.0.0.0')
Fiorella Quino
Main files have been updated...
r266 dns = forms.GenericIPAddressField(initial='0.0.0.0')
Juan C. Espinoza
Add Change IP function for DDS Device...
r219