##// END OF EJS Templates
comment missing views...
comment missing views git-svn-id: http://jro-dev.igp.gob.pe/svn/jro_hard/radarsys/trunk/webapp@196 aa17d016-51d5-4e8b-934c-7b2bbb1bbe71

File last commit:

r172:a641bec15a9b
r173:63992b89a422
Show More
views.py
1589 lines | 49.2 KiB | text/x-python | PythonLexer
Miguel Urco
Views: Display "Page not found (404)" in case there is no object with the given pk....
r20 from django.shortcuts import render, redirect, get_object_or_404, HttpResponse
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 from django.utils.safestring import mark_safe
Fiorella Quino
Task #487: Operation. Views: radar_play y radar_stop. Models: RunningExperiment. Attributes: status. Methods: get_status(), status_color()...
r84 from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 from django.db.models import Q
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
Miguel Urco
Buttons "Import", "Export, "Read" and "Write" added to Configuration View...
r30 from django.contrib import messages
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 from django.http.request import QueryDict
Fiorella Quino
Task 487: Operation View gets status from database and radar_refresh button updates status...
r88 from datetime import datetime
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
Juan C. Espinoza
Updating base models and views ...
r6
Juan C. Espinoza
Update several views and models in main app...
r85 from .forms import CampaignForm, ExperimentForm, DeviceForm, ConfigurationForm, LocationForm, UploadFileForm, DownloadFileForm, OperationForm, NewForm
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 from .forms import OperationSearchForm, FilterForm
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
from apps.rc.forms import RCConfigurationForm
from apps.dds.forms import DDSConfigurationForm
Miguel Urco
Campaign has been added to RadarSys Model...
r13 from apps.jars.forms import JARSConfigurationForm
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 from apps.cgs.forms import CGSConfigurationForm
Miguel Urco
Campaign has been added to RadarSys Model...
r13 from apps.abs.forms import ABSConfigurationForm
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 from apps.usrp.forms import USRPConfigurationForm
Miguel Urco
Campaign has been added to RadarSys Model...
r13
Fiorella Quino
Task #487: Operation. Views: radar_play y radar_stop. Models: RunningExperiment. Attributes: status. Methods: get_status(), status_color()...
r84 from .models import Campaign, Experiment, Device, Configuration, Location, RunningExperiment
Juan C. Espinoza
Updating base models and views ...
r6 from apps.cgs.models import CGSConfiguration
Fiorella Quino
Task #559: Vista de Summary (main: urls, views, experiment.html, experiment_summary.html)...
r151 from apps.jars.models import JARSConfiguration, EXPERIMENT_TYPE
Miguel Urco
Campaign has been added to RadarSys Model...
r13 from apps.usrp.models import USRPConfiguration
Juan C. Espinoza
Updating base models and views ...
r6 from apps.abs.models import ABSConfiguration
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 from apps.rc.models import RCConfiguration, RCLine, RCLineType
Juan C. Espinoza
Updating base models and views ...
r6 from apps.dds.models import DDSConfiguration
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 from django.http.request import QueryDict
Juan C. Espinoza
sync repo...
r157 #from __builtin__ import False
Juan C. Espinoza
Proyecto base en Django (refs #259) ...
r0
# Create your views here.
Miguel Urco
Campaign has been added to RadarSys Model...
r13 CONF_FORMS = {
'rc': RCConfigurationForm,
'dds': DDSConfigurationForm,
'jars': JARSConfigurationForm,
'cgs': CGSConfigurationForm,
'abs': ABSConfigurationForm,
'usrp': USRPConfigurationForm,
}
CONF_MODELS = {
Juan C. Espinoza
Updating base models and views ...
r6 'rc': RCConfiguration,
'dds': DDSConfiguration,
'jars': JARSConfiguration,
'cgs': CGSConfiguration,
'abs': ABSConfiguration,
Miguel Urco
Campaign has been added to RadarSys Model...
r13 'usrp': USRPConfiguration,
Juan C. Espinoza
Updating base models and views ...
r6 }
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 MIX_MODES = {
Juan C. Espinoza
Fix mix RC configurations for different ipp's...
r112 '0': 'P',
'1': 'S',
}
MIX_OPERATIONS = {
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 '0': 'OR',
'1': 'XOR',
'2': 'AND',
Juan C. Espinoza
Fix mix RC configurations for different ipp's...
r112 '3': 'NAND',
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 }
Juan C. Espinoza
Update views and templates of main app...
r89
Juan C. Espinoza
Updating base models and views ...
r6 def index(request):
Juan C. Espinoza
Proyecto base en Django (refs #259) ...
r0 kwargs = {}
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 return render(request, 'index.html', kwargs)
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
Location model added to RadarSys...
r41 def locations(request):
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 page = request.GET.get('page')
order = ('name',)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
kwargs = get_paginator(Location, page, order)
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 kwargs['keys'] = ['name', 'description']
kwargs['title'] = 'Radar System'
Miguel Urco
Location model added to RadarSys...
r41 kwargs['suptitle'] = 'List'
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 return render(request, 'base_list.html', kwargs)
Miguel Urco
Location model added to RadarSys...
r41
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
Location model added to RadarSys...
r41 def location(request, id_loc):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Location model added to RadarSys...
r41 location = get_object_or_404(Location, pk=id_loc)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Location model added to RadarSys...
r41 kwargs = {}
kwargs['location'] = location
kwargs['location_keys'] = ['name', 'description']
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Location model added to RadarSys...
r41 kwargs['title'] = 'Location'
kwargs['suptitle'] = 'Details'
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Location model added to RadarSys...
r41 return render(request, 'location.html', kwargs)
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
Miguel Urco
Location model added to RadarSys...
r41 def location_new(request):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Location model added to RadarSys...
r41 if request.method == 'GET':
form = LocationForm()
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Location model added to RadarSys...
r41 if request.method == 'POST':
form = LocationForm(request.POST)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Location model added to RadarSys...
r41 if form.is_valid():
form.save()
return redirect('url_locations')
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Location model added to RadarSys...
r41 kwargs = {}
kwargs['form'] = form
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 kwargs['title'] = 'Radar System'
Miguel Urco
Location model added to RadarSys...
r41 kwargs['suptitle'] = 'New'
kwargs['button'] = 'Create'
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 return render(request, 'base_edit.html', kwargs)
Miguel Urco
Location model added to RadarSys...
r41
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
Location model added to RadarSys...
r41 def location_edit(request, id_loc):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Location model added to RadarSys...
r41 location = get_object_or_404(Location, pk=id_loc)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Location model added to RadarSys...
r41 if request.method=='GET':
form = LocationForm(instance=location)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Location model added to RadarSys...
r41 if request.method=='POST':
form = LocationForm(request.POST, instance=location)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Location model added to RadarSys...
r41 if form.is_valid():
form.save()
return redirect('url_locations')
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Location model added to RadarSys...
r41 kwargs = {}
kwargs['form'] = form
kwargs['title'] = 'Location'
kwargs['suptitle'] = 'Edit'
kwargs['button'] = 'Update'
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 return render(request, 'base_edit.html', kwargs)
Miguel Urco
Location model added to RadarSys...
r41
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
Location model added to RadarSys...
r41 def location_delete(request, id_loc):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Location model added to RadarSys...
r41 location = get_object_or_404(Location, pk=id_loc)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Location model added to RadarSys...
r41 if request.method=='POST':
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Location model added to RadarSys...
r41 if request.user.is_staff:
location.delete()
return redirect('url_locations')
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 and templates of main app...
r89 messages.error(request, 'Not enough permission to delete this object')
return redirect(location.get_absolute_url())
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 and templates of main app...
r89 kwargs = {
'title': 'Delete',
'suptitle': 'Location',
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 'object': location,
Juan C. Espinoza
Update views and templates of main app...
r89 'previous': location.get_absolute_url(),
'delete': True
}
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 and templates of main app...
r89 return render(request, 'confirm.html', kwargs)
Miguel Urco
Location model added to RadarSys...
r41
Miguel Urco
Campaign has been added to RadarSys Model...
r13 def devices(request):
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 page = request.GET.get('page')
order = ('device_type', 'name')
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
kwargs = get_paginator(Device, page, order)
kwargs['keys'] = ['name', 'ip_address', 'port_address', 'device_type']
Miguel Urco
Campaign has been added to RadarSys Model...
r13 kwargs['title'] = 'Device'
kwargs['suptitle'] = 'List'
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 return render(request, 'base_list.html', kwargs)
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
Campaign has been added to RadarSys Model...
r13 def device(request, id_dev):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Views: Display "Page not found (404)" in case there is no object with the given pk....
r20 device = get_object_or_404(Device, pk=id_dev)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2 kwargs = {}
Miguel Urco
Campaign has been added to RadarSys Model...
r13 kwargs['device'] = device
kwargs['device_keys'] = ['device_type', 'name', 'ip_address', 'port_address', 'description']
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 kwargs['title'] = 'Device'
kwargs['suptitle'] = 'Details'
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 return render(request, 'device.html', kwargs)
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
views name were changed ...
r19 def device_new(request):
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 if request.method == 'GET':
form = DeviceForm()
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 if request.method == 'POST':
form = DeviceForm(request.POST)
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 if form.is_valid():
form.save()
return redirect('url_devices')
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 kwargs = {}
kwargs['form'] = form
kwargs['title'] = 'Device'
kwargs['suptitle'] = 'New'
kwargs['button'] = 'Create'
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 return render(request, 'base_edit.html', kwargs)
Juan C. Espinoza
Updating base models and views ...
r6
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
views name were changed ...
r19 def device_edit(request, id_dev):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Views: Display "Page not found (404)" in case there is no object with the given pk....
r20 device = get_object_or_404(Device, pk=id_dev)
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 if request.method=='GET':
form = DeviceForm(instance=device)
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 if request.method=='POST':
Miguel Urco
Campaign has been added to RadarSys Model...
r13 form = DeviceForm(request.POST, instance=device)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2 if form.is_valid():
form.save()
Juan C. Espinoza
Update views and templates of main app...
r89 return redirect(device.get_absolute_url())
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 kwargs = {}
kwargs['form'] = form
kwargs['title'] = 'Device'
kwargs['suptitle'] = 'Edit'
kwargs['button'] = 'Update'
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 return render(request, 'base_edit.html', kwargs)
Juan C. Espinoza
Updating base models and views ...
r6
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
views name were changed ...
r19 def device_delete(request, id_dev):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Views: Display "Page not found (404)" in case there is no object with the given pk....
r20 device = get_object_or_404(Device, pk=id_dev)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
delete interface added to views...
r18 if request.method=='POST':
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
delete interface added to views...
r18 if request.user.is_staff:
device.delete()
return redirect('url_devices')
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 and templates of main app...
r89 messages.error(request, 'Not enough permission to delete this object')
return redirect(device.get_absolute_url())
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 and templates of main app...
r89 kwargs = {
'title': 'Delete',
'suptitle': 'Device',
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 'object': device,
Juan C. Espinoza
Update views and templates of main app...
r89 'previous': device.get_absolute_url(),
'delete': True
}
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 and templates of main app...
r89 return render(request, 'confirm.html', kwargs)
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 campaigns(request):
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 page = request.GET.get('page')
order = ('start_date',)
filters = request.GET.copy()
kwargs = get_paginator(Campaign, page, order, filters)
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 form = FilterForm(initial=request.GET, extra_fields=['range_date', 'tags','template'])
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 kwargs['keys'] = ['name', 'start_date', 'end_date']
Miguel Urco
Campaign has been added to RadarSys Model...
r13 kwargs['title'] = 'Campaign'
kwargs['suptitle'] = 'List'
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 kwargs['form'] = form
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 filters.pop('page', None)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 kwargs['q'] = urlencode(filters)
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 return render(request, 'base_list.html', kwargs)
Miguel Urco
Campaign has been added to RadarSys Model...
r13
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
Campaign has been added to RadarSys Model...
r13 def campaign(request, id_camp):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Views: Display "Page not found (404)" in case there is no object with the given pk....
r20 campaign = get_object_or_404(Campaign, pk=id_camp)
Miguel Urco
Models changed:...
r53 experiments = Experiment.objects.filter(campaign=campaign)
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 form = CampaignForm(instance=campaign)
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 kwargs = {}
kwargs['campaign'] = campaign
Juan C. Espinoza
Update views and templates of main app...
r89 kwargs['campaign_keys'] = ['template', 'name', 'start_date', 'end_date', 'tags', 'description']
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 and templates of main app...
r89 kwargs['experiments'] = experiments
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 kwargs['experiment_keys'] = ['name', 'radar_system', 'start_time', 'end_time']
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 kwargs['title'] = 'Campaign'
kwargs['suptitle'] = 'Details'
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 kwargs['form'] = form
kwargs['button'] = 'Add Experiment'
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 return render(request, 'campaign.html', kwargs)
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
views name were changed ...
r19 def campaign_new(request):
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 kwargs = {}
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 if request.method == 'GET':
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 'template' in request.GET:
if request.GET['template']=='0':
form = NewForm(initial={'create_from':2},
template_choices=Campaign.objects.filter(template=True).values_list('id', 'name'))
else:
kwargs['button'] = 'Create'
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 kwargs['experiments'] = Configuration.objects.filter(experiment=request.GET['template'])
Juan C. Espinoza
Update several views and models in main app...
r85 kwargs['experiment_keys'] = ['name', 'start_time', 'end_time']
Juan C. Espinoza
Update new and edit "views"...
r91 camp = Campaign.objects.get(pk=request.GET['template'])
form = CampaignForm(instance=camp,
initial={'name':'{} [{:%Y/%m/%d}]'.format(camp.name, datetime.now()),
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 'template':False})
Juan C. Espinoza
Update several views and models in main app...
r85 elif 'blank' in request.GET:
kwargs['button'] = 'Create'
form = CampaignForm()
else:
form = NewForm()
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 if request.method == 'POST':
Juan C. Espinoza
Update several views and models in main app...
r85 kwargs['button'] = 'Create'
post = request.POST.copy()
experiments = []
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 for id_exp in post.getlist('experiments'):
exp = Experiment.objects.get(pk=id_exp)
new_exp = exp.clone(template=False)
experiments.append(new_exp)
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 post.setlist('experiments', [])
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 form = CampaignForm(post)
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 if form.is_valid():
campaign = form.save()
Juan C. Espinoza
Update several views and models in main app...
r85 for exp in experiments:
campaign.experiments.add(exp)
campaign.save()
Miguel Urco
Campaign has been added to RadarSys Model...
r13 return redirect('url_campaign', id_camp=campaign.id)
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 kwargs['form'] = form
kwargs['title'] = 'Campaign'
kwargs['suptitle'] = 'New'
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 return render(request, 'campaign_edit.html', kwargs)
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
views name were changed ...
r19 def campaign_edit(request, id_camp):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Views: Display "Page not found (404)" in case there is no object with the given pk....
r20 campaign = get_object_or_404(Campaign, pk=id_camp)
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 if request.method=='GET':
form = CampaignForm(instance=campaign)
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 if request.method=='POST':
Juan C. Espinoza
Update new and edit "views"...
r91 exps = campaign.experiments.all().values_list('pk', flat=True)
post = request.POST.copy()
new_exps = post.getlist('experiments')
post.setlist('experiments', [])
form = CampaignForm(post, instance=campaign)
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 if form.is_valid():
Juan C. Espinoza
Update new and edit "views"...
r91 camp = form.save()
for id_exp in new_exps:
if int(id_exp) in exps:
exps.pop(id_exp)
else:
exp = Experiment.objects.get(pk=id_exp)
if exp.template:
camp.experiments.add(exp.clone(template=False))
else:
camp.experiments.add(exp)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
Update new and edit "views"...
r91 for id_exp in exps:
camp.experiments.remove(Experiment.objects.get(pk=id_exp))
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 return redirect('url_campaign', id_camp=id_camp)
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 kwargs = {}
kwargs['form'] = form
kwargs['title'] = 'Campaign'
kwargs['suptitle'] = 'Edit'
kwargs['button'] = 'Update'
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 return render(request, 'campaign_edit.html', kwargs)
Juan C. Espinoza
Updating base models and views ...
r6
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
views name were changed ...
r19 def campaign_delete(request, id_camp):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Views: Display "Page not found (404)" in case there is no object with the given pk....
r20 campaign = get_object_or_404(Campaign, pk=id_camp)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
delete interface added to views...
r18 if request.method=='POST':
if request.user.is_staff:
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 for exp in campaign.experiments.all():
for conf in Configuration.objects.filter(experiment=exp):
conf.delete()
exp.delete()
Miguel Urco
delete interface added to views...
r18 campaign.delete()
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
delete interface added to views...
r18 return redirect('url_campaigns')
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 and templates of main app...
r89 messages.error(request, 'Not enough permission to delete this object')
return redirect(campaign.get_absolute_url())
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 and templates of main app...
r89 kwargs = {
'title': 'Delete',
'suptitle': 'Campaign',
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 'object': campaign,
Juan C. Espinoza
Update views and templates of main app...
r89 'previous': campaign.get_absolute_url(),
'delete': True
}
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 and templates of main app...
r89 return render(request, 'confirm.html', kwargs)
Fiorella Quino
Export Campaign ...
r100 def campaign_export(request, id_camp):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Export Campaign ...
r100 campaign = get_object_or_404(Campaign, pk=id_camp)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 content = campaign.parms_to_dict()
Fiorella Quino
Export Campaign ...
r100 content_type = 'application/json'
filename = '%s_%s.json' %(campaign.name, campaign.id)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Export Campaign ...
r100 response = HttpResponse(content_type=content_type)
response['Content-Disposition'] = 'attachment; filename="%s"' %filename
response.write(content)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Export Campaign ...
r100 return response
Miguel Urco
delete interface added to views...
r18
Fiorella Quino
Import Experiment Function...
r108
def campaign_import(request, id_camp):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Import Experiment Function...
r108 campaign = get_object_or_404(Campaign, pk=id_camp)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Import Experiment Function...
r108 if request.method == 'GET':
file_form = UploadFileForm()
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Import Experiment Function...
r108 if request.method == 'POST':
file_form = UploadFileForm(request.POST, request.FILES)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Import Experiment Function...
r108 if file_form.is_valid():
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Import Experiment Function...
r108 parms = campaign.import_from_file(request.FILES['file'])
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Import Experiment Function...
r108 if parms:
Fiorella Quino
Import Campaign: dict_to_parms(self, parms, CONF_MODELS)(models.py), campaign_import (views.py)...
r109 parms['name'] = parms['campaign']
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Import Campaign...
r110 new_camp = campaign.dict_to_parms(parms, CONF_MODELS)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Import Experiment Function...
r108 messages.success(request, "Parameters imported from: '%s'." %request.FILES['file'].name)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Import Campaign...
r110 return redirect(new_camp.get_absolute_url_edit())
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Import Experiment Function...
r108 messages.error(request, "Could not import parameters from file")
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Import Experiment Function...
r108 kwargs = {}
kwargs['title'] = 'Campaign'
kwargs['form'] = file_form
kwargs['suptitle'] = 'Importing file'
kwargs['button'] = 'Import'
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Import Experiment Function...
r108 return render(request, 'campaign_import.html', kwargs)
Miguel Urco
Campaign has been added to RadarSys Model...
r13 def experiments(request):
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 page = request.GET.get('page')
order = ('location',)
filters = request.GET.copy()
kwargs = get_paginator(Experiment, page, order, filters)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
form = FilterForm(initial=request.GET, extra_fields=['tags','template'])
kwargs['keys'] = ['name', 'radar_system', 'start_time', 'end_time']
Miguel Urco
Campaign has been added to RadarSys Model...
r13 kwargs['title'] = 'Experiment'
kwargs['suptitle'] = 'List'
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 kwargs['form'] = form
filters.pop('page', None)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 kwargs['q'] = urlencode(filters)
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 return render(request, 'base_list.html', kwargs)
Miguel Urco
Campaign has been added to RadarSys Model...
r13
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
Campaign has been added to RadarSys Model...
r13 def experiment(request, id_exp):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Views: Display "Page not found (404)" in case there is no object with the given pk....
r20 experiment = get_object_or_404(Experiment, pk=id_exp)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Location model added to RadarSys...
r41 configurations = Configuration.objects.filter(experiment=experiment, type=0)
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 kwargs = {}
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 kwargs['experiment_keys'] = ['template', 'radar_system', 'name', 'start_time', 'end_time']
Miguel Urco
Campaign has been added to RadarSys Model...
r13 kwargs['experiment'] = experiment
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
- Improve display name for Devices & Configurations...
r121 kwargs['configuration_keys'] = ['name', 'device__ip_address', 'device__port_address', 'device__status']
Juan C. Espinoza
Update new and edit "views"...
r91 kwargs['configurations'] = configurations
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 kwargs['title'] = 'Experiment'
kwargs['suptitle'] = 'Details'
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
Update RC models, views, templates & statics...
r45 kwargs['button'] = 'Add Configuration'
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 ###### SIDEBAR ######
kwargs.update(sidebar(experiment=experiment))
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 return render(request, 'experiment.html', kwargs)
Juan C. Espinoza
Update several views and models in main app...
r85
Juan C. Espinoza
- Update rc app...
r79 def experiment_new(request, id_camp=None):
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 kwargs = {}
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 if request.method == 'GET':
Juan C. Espinoza
Update several views and models in main app...
r85 if 'template' in request.GET:
if request.GET['template']=='0':
form = NewForm(initial={'create_from':2},
template_choices=Experiment.objects.filter(template=True).values_list('id', 'name'))
else:
kwargs['button'] = 'Create'
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 kwargs['configurations'] = Configuration.objects.filter(experiment=request.GET['template'])
Juan C. Espinoza
Update several views and models in main app...
r85 kwargs['configuration_keys'] = ['name', 'device__name', 'device__ip_address', 'device__port_address']
Juan C. Espinoza
Update new and edit "views"...
r91 exp=Experiment.objects.get(pk=request.GET['template'])
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 form = ExperimentForm(instance=exp,
Juan C. Espinoza
Update new and edit "views"...
r91 initial={'name': '{} [{:%Y/%m/%d}]'.format(exp.name, datetime.now()),
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 'template': False})
Juan C. Espinoza
Update several views and models in main app...
r85 elif 'blank' in request.GET:
kwargs['button'] = 'Create'
form = ExperimentForm()
else:
form = NewForm()
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 if request.method == 'POST':
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 form = ExperimentForm(request.POST)
Juan C. Espinoza
Updating base models and views ...
r6 if form.is_valid():
experiment = form.save()
Juan C. Espinoza
Update several views and models in main app...
r85
if 'template' in request.GET:
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 configurations = Configuration.objects.filter(experiment=request.GET['template'], type=0)
Juan C. Espinoza
Update several views and models in main app...
r85 for conf in configurations:
conf.clone(experiment=experiment, template=False)
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 return redirect('url_experiment', id_exp=experiment.id)
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 kwargs['form'] = form
Juan C. Espinoza
Updating base models and views ...
r6 kwargs['title'] = 'Experiment'
kwargs['suptitle'] = 'New'
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 return render(request, 'experiment_edit.html', kwargs)
Juan C. Espinoza
Updating base models and views ...
r6
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
views name were changed ...
r19 def experiment_edit(request, id_exp):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Views: Display "Page not found (404)" in case there is no object with the given pk....
r20 experiment = get_object_or_404(Experiment, pk=id_exp)
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 if request.method == 'GET':
form = ExperimentForm(instance=experiment)
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 if request.method=='POST':
Miguel Urco
Campaign has been added to RadarSys Model...
r13 form = ExperimentForm(request.POST, instance=experiment)
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 if form.is_valid():
Miguel Urco
Campaign has been added to RadarSys Model...
r13 experiment = form.save()
return redirect('url_experiment', id_exp=experiment.id)
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 kwargs = {}
kwargs['form'] = form
kwargs['title'] = 'Experiment'
kwargs['suptitle'] = 'Edit'
kwargs['button'] = 'Update'
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 return render(request, 'experiment_edit.html', kwargs)
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
views name were changed ...
r19 def experiment_delete(request, id_exp):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Views: Display "Page not found (404)" in case there is no object with the given pk....
r20 experiment = get_object_or_404(Experiment, pk=id_exp)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
delete interface added to views...
r18 if request.method=='POST':
if request.user.is_staff:
Juan C. Espinoza
Update new and edit "views"...
r91 for conf in Configuration.objects.filter(experiment=experiment):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 conf.delete()
Miguel Urco
delete interface added to views...
r18 experiment.delete()
Juan C. Espinoza
Update several views and models in main app...
r85 return redirect('url_experiments')
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
Update new and edit "views"...
r91 messages.error(request, 'Not enough permission to delete this object')
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 return redirect(experiment.get_absolute_url())
Juan C. Espinoza
Update new and edit "views"...
r91 kwargs = {
'title': 'Delete',
'suptitle': 'Experiment',
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 'object': experiment,
Juan C. Espinoza
Update new and edit "views"...
r91 'previous': experiment.get_absolute_url(),
'delete': True
}
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
Update new and edit "views"...
r91 return render(request, 'confirm.html', kwargs)
Miguel Urco
delete interface added to views...
r18
Juan C. Espinoza
Update views and templates of main app...
r89
Fiorella Quino
Export Campaign ...
r100 def experiment_export(request, id_exp):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Export Campaign ...
r100 experiment = get_object_or_404(Experiment, pk=id_exp)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 content = experiment.parms_to_dict()
Fiorella Quino
Export Campaign ...
r100 content_type = 'application/json'
filename = '%s_%s.json' %(experiment.name, experiment.id)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Export Campaign ...
r100 response = HttpResponse(content_type=content_type)
response['Content-Disposition'] = 'attachment; filename="%s"' %filename
response.write(content)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Export Campaign ...
r100 return response
Fiorella Quino
Import Experiment Function...
r108 def experiment_import(request, id_exp):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Import Experiment Function...
r108 experiment = get_object_or_404(Experiment, pk=id_exp)
configurations = Configuration.objects.filter(experiment=experiment)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Import Experiment Function...
r108 if request.method == 'GET':
file_form = UploadFileForm()
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Import Experiment Function...
r108 if request.method == 'POST':
file_form = UploadFileForm(request.POST, request.FILES)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Import Experiment Function...
r108 if file_form.is_valid():
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Import Experiment Function...
r108 parms = experiment.import_from_file(request.FILES['file'])
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Import Experiment Function...
r108 if parms:
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Import Campaign...
r110 new_exp = experiment.dict_to_parms(parms, CONF_MODELS)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Import Experiment Function...
r108 messages.success(request, "Parameters imported from: '%s'." %request.FILES['file'].name)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
return redirect(new_exp.get_absolute_url_edit())
Fiorella Quino
Import Experiment Function...
r108
messages.error(request, "Could not import parameters from file")
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Import Experiment Function...
r108 kwargs = {}
kwargs['title'] = 'Experiment'
kwargs['form'] = file_form
kwargs['suptitle'] = 'Importing file'
kwargs['button'] = 'Import'
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Import Experiment Function...
r108 kwargs.update(sidebar(experiment=experiment))
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Import Experiment Function...
r108 return render(request, 'experiment_import.html', kwargs)
Fiorella Quino
Export Campaign ...
r100
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 def experiment_mix(request, id_exp):
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 experiment = get_object_or_404(Experiment, pk=id_exp)
rc_confs = [conf for conf in RCConfiguration.objects.filter(experiment=id_exp,
mix=False)]
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 len(rc_confs)<2:
messages.warning(request, 'You need at least two RC Configurations to make a mix')
return redirect(experiment.get_absolute_url())
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 mix_confs = RCConfiguration.objects.filter(experiment=id_exp, mix=True)
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 mix_confs:
mix = mix_confs[0]
else:
mix = RCConfiguration(experiment=experiment,
device=rc_confs[0].device,
ipp=rc_confs[0].ipp,
clock_in=rc_confs[0].clock_in,
clock_divider=rc_confs[0].clock_divider,
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 mix=True,
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 parameters='')
mix.save()
line_type = RCLineType.objects.get(name='mix')
for i in range(len(rc_confs[0].get_lines())):
line = RCLine(rc_configuration=mix, line_type=line_type, channel=i)
line.save()
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 initial = {'name': mix.name,
'result': parse_mix_result(mix.parameters),
'delay': 0,
'mask': [0,1,2,3,4,5,6,7]
}
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
if request.method=='GET':
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 form = RCMixConfigurationForm(confs=rc_confs, initial=initial)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
Fix mix RC configurations for different ipp's...
r112 if request.method=='POST':
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 result = mix.parameters
if '{}|'.format(request.POST['experiment']) in result:
messages.error(request, 'Configuration already added')
else:
Juan C. Espinoza
Fix mix RC configurations for different ipp's...
r112 if 'operation' in request.POST:
operation = MIX_OPERATIONS[request.POST['operation']]
else:
Juan C. Espinoza
- Add sequence mode in mix configurations....
r116 operation = ' '
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
Fix mix RC configurations for different ipp's...
r112 mode = MIX_MODES[request.POST['mode']]
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 result:
Juan C. Espinoza
Fix mix RC configurations for different ipp's...
r112 result = '{}-{}|{}|{}|{}|{}'.format(mix.parameters,
request.POST['experiment'],
mode,
operation,
float(request.POST['delay']),
parse_mask(request.POST.getlist('mask'))
)
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 else:
Juan C. Espinoza
Fix mix RC configurations for different ipp's...
r112 result = '{}|{}|{}|{}|{}'.format(request.POST['experiment'],
mode,
operation,
float(request.POST['delay']),
parse_mask(request.POST.getlist('mask'))
)
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 mix.parameters = result
mix.name = request.POST['name']
mix.save()
mix.update_pulses()
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 initial['result'] = parse_mix_result(result)
initial['name'] = mix.name
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 form = RCMixConfigurationForm(initial=initial, confs=rc_confs)
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 kwargs = {
'title': 'Experiment',
'suptitle': 'Mix Configurations',
'form' : form,
'extra_button': 'Delete',
'button': 'Add',
'cancel': 'Back',
'previous': experiment.get_absolute_url(),
'id_exp':id_exp,
}
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 return render(request, 'experiment_mix.html', kwargs)
def experiment_mix_delete(request, id_exp):
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 conf = RCConfiguration.objects.get(experiment=id_exp, mix=True)
values = conf.parameters.split('-')
conf.parameters = '-'.join(values[:-1])
conf.save()
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 return redirect('url_mix_experiment', id_exp=id_exp)
Fiorella Quino
Task #559: Vista de Summary (main: urls, views, experiment.html, experiment_summary.html)...
r151 def experiment_summary(request, id_exp):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #559: Vista de Summary (main: urls, views, experiment.html, experiment_summary.html)...
r151 import json
Juan C. Espinoza
sync repo...
r157 import ast
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #559: Vista de Summary (main: urls, views, experiment.html, experiment_summary.html)...
r151 experiment = get_object_or_404(Experiment, pk=id_exp)
experiment_data = json.loads(experiment.parms_to_dict())
configurations = Configuration.objects.filter(experiment=experiment, type=0)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #559: Vista de Summary (main: urls, views, experiment.html, experiment_summary.html)...
r151 kwargs = {}
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #559: Vista de Summary (main: urls, views, experiment.html, experiment_summary.html)...
r151 kwargs['experiment_keys'] = ['template', 'radar_system', 'name', 'start_time', 'end_time']
kwargs['experiment'] = experiment
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #559: Vista de Summary (main: urls, views, experiment.html, experiment_summary.html)...
r151 kwargs['configuration_keys'] = ['name', 'device__ip_address', 'device__port_address', 'device__status']
kwargs['configurations'] = configurations
kwargs['experiment_data'] = experiment_data
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #559: Vista de Summary (main: urls, views, experiment.html, experiment_summary.html)...
r151 kwargs['title'] = 'Experiment Summary'
kwargs['suptitle'] = 'Details'
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #559: Vista de Summary (main: urls, views, experiment.html, experiment_summary.html)...
r151 kwargs['button'] = 'Verify Parameters'
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
sync repo...
r157 jars_conf = False
rc_conf = False
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #559: Vista de Summary (main: urls, views, experiment.html, experiment_summary.html)...
r151 for configuration in configurations:
Juan C. Espinoza
sync repo...
r157 #-------------------- JARS -----------------------:
Fiorella Quino
Task #559: Vista de Summary (main: urls, views, experiment.html, experiment_summary.html)...
r151 if configuration.device.device_type.name == 'jars':
Juan C. Espinoza
sync repo...
r157 jars_conf = True
kwargs['jars_conf'] = jars_conf
kwargs['exp_type'] = EXPERIMENT_TYPE[configuration.exp_type][1]
channels_number = configuration.channels_number
exp_type = configuration.exp_type
fftpoints = configuration.fftpoints
filter_parms = configuration.filter_parms
filter_parms = ast.literal_eval(filter_parms)
spectral_number = configuration.spectral_number
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
sync repo...
r157 #--------------------- RC ----------------------:
Fiorella Quino
Task #559: Vista de Summary (main: urls, views, experiment.html, experiment_summary.html)...
r151 if configuration.device.device_type.name == 'rc':
Juan C. Espinoza
sync repo...
r157 rc_conf = True
kwargs['rc_conf'] = rc_conf
Fiorella Quino
Task #559: Vista de Summary (main: urls, views, experiment.html, experiment_summary.html)...
r151 rc_lines = experiment_data['configurations']['rc']['lines']
Juan C. Espinoza
sync repo...
r157 ipp = configuration.ipp
Fiorella Quino
Task #559: Vista de Summary (bug)...
r154 if experiment_data['configurations']['rc']['mix'] == 'True':
Fiorella Quino
Task #559: Vista de Summary (bug)...
r152 tx = ''
code = ''
window = ''
Fiorella Quino
Task #559: Vista de Summary (main: urls, views, experiment.html, experiment_summary.html)...
r151 else:
Fiorella Quino
Task #559: Vista de Summary (bug)...
r152 code = rc_lines[3]['code']
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #559: Vista de Summary (bug)...
r152 window_data = rc_lines[6]['params'][0]
h0 = str(window_data['first_height'])
dh = str(window_data['resolution'])
nsa = str(window_data['number_of_samples'])
window = 'Ho='+h0+'km\nDH='+dh+'km\nNSA='+nsa
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #559: Vista de Summary (bug)...
r152 tx = ''
if float(rc_lines[1]['delays']) == 0:
tx = rc_lines[2]['pulse_width']
elif float(rc_lines[2]['delays']) == 0:
tx = rc_lines[1]['pulse_width']
else:
tx = rc_lines[1]['pulse_width']+' | '+rc_lines[2]['pulse_width']
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #559: Vista de Summary (main: urls, views, experiment.html, experiment_summary.html)...
r151 kwargs['tx'] = tx
kwargs['code'] = code
kwargs['window'] = window
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
sync repo...
r157 #-------------------- DDS -----------------------:
if configuration.device.device_type.name == 'dds':
dds_conf = True
kwargs['dds_conf'] = dds_conf
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
sync repo...
r157 #------ RC & JARS ------:
ipp = 937.5 #
nsa = 200#
dh = 1.5 #
channels_number = 5 #
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
sync repo...
r157 if rc_conf and jars_conf:
if exp_type == 0: #Short
bytes = 2
b = nsa*2*bytes*channels_number
else: #Float
bytes = 4
channels = channels_number + spectral_number
b = nsa*2*bytes*fftpoints*channels
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
sync repo...
r157 ipps = (ipp*pow(10,-6))/0.15
GB = 1048576.0*1024.0
Hour = 3600
rate = b/ipps
rate = rate *(1/GB)*(Hour)
kwargs['rate'] = str(rate)+" GB/h"
else:
kwargs['rate'] = ''
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #559: Vista de Summary (main: urls, views, experiment.html, experiment_summary.html)...
r151 ###### SIDEBAR ######
kwargs.update(sidebar(experiment=experiment))
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #559: Vista de Summary (main: urls, views, experiment.html, experiment_summary.html)...
r151 return render(request, 'experiment_summary.html', kwargs)
Juan C. Espinoza
sync repo...
r157 def experiment_verify(request, id_exp):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
import json
Juan C. Espinoza
sync repo...
r157 import ast
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
sync repo...
r157 experiment = get_object_or_404(Experiment, pk=id_exp)
experiment_data = json.loads(experiment.parms_to_dict())
configurations = Configuration.objects.filter(experiment=experiment, type=0)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
sync repo...
r157 kwargs = {}
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
sync repo...
r157 kwargs['experiment_keys'] = ['template', 'radar_system', 'name', 'start_time', 'end_time']
kwargs['experiment'] = experiment
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
sync repo...
r157 kwargs['configuration_keys'] = ['name', 'device__ip_address', 'device__port_address', 'device__status']
kwargs['configurations'] = configurations
kwargs['experiment_data'] = experiment_data
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
sync repo...
r157 kwargs['title'] = 'Verify Experiment'
kwargs['suptitle'] = 'Parameters'
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
sync repo...
r157 kwargs['button'] = 'Update'
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
sync repo...
r157 jars_conf = False
rc_conf = False
dds_conf = False
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
sync repo...
r157 for configuration in configurations:
#-------------------- JARS -----------------------:
if configuration.device.device_type.name == 'jars':
jars_conf = True
kwargs['jars_conf'] = jars_conf
filter_parms = configuration.filter_parms
filter_parms = ast.literal_eval(filter_parms)
kwargs['filter_parms'] = filter_parms
#--Sampling Frequency
clock = filter_parms['clock']
filter_2 = filter_parms['filter_2']
filter_5 = filter_parms['filter_5']
filter_fir = filter_parms['filter_fir']
samp_freq_jars = clock/filter_2/filter_5/filter_fir
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
sync repo...
r157 kwargs['samp_freq_jars'] = samp_freq_jars
kwargs['jars'] = configuration
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
sync repo...
r157 #--------------------- RC ----------------------:
if configuration.device.device_type.name == 'rc':
rc_conf = True
rc_parms = configuration.parms_to_dict()
if rc_parms['mix'] == 'True':
pass
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 else:
Juan C. Espinoza
sync repo...
r157 rc_lines = rc_parms['lines']
dh = rc_lines[6]['params'][0]['resolution']
#--Sampling Frequency
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 samp_freq_rc = 0.15/dh
Juan C. Espinoza
sync repo...
r157 kwargs['samp_freq_rc'] = samp_freq_rc
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
sync repo...
r157 kwargs['rc_conf'] = rc_conf
kwargs['rc'] = configuration
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
sync repo...
r157 #-------------------- DDS ----------------------:
if configuration.device.device_type.name == 'dds':
dds_conf = True
dds_parms = configuration.parms_to_dict()
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
sync repo...
r157 kwargs['dds_conf'] = dds_conf
kwargs['dds'] = configuration
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
sync repo...
r157 #------------Validation------------:
#Clock
if dds_conf and rc_conf and jars_conf:
if filter_parms['clock'] != rc_parms['clock_in'] and rc_parms['clock_in'] != dds_parms['clock']:
messages.warning(request, "Devices don't have the same clock.")
elif rc_conf and jars_conf:
if filter_parms['clock'] != rc_parms['clock_in']:
messages.warning(request, "Devices don't have the same clock.")
elif rc_conf and dds_conf:
if rc_parms['clock_in'] != dds_parms['clock']:
messages.warning(request, "Devices don't have the same clock.")
if float(samp_freq_rc) != float(dds_parms['frequencyA']):
messages.warning(request, "Devices don't have the same Frequency A.")
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
sync repo...
r157 ###### SIDEBAR ######
kwargs.update(sidebar(experiment=experiment))
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
sync repo...
r157 return render(request, 'experiment_verify.html', kwargs)
Fiorella Quino
Task #559: Vista de Summary (main: urls, views, experiment.html, experiment_summary.html)...
r151
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 def parse_mix_result(s):
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 values = s.split('-')
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 html = 'EXP MOD OPE DELAY MASK\r\n'
Juan C. Espinoza
Fix mix RC configurations for different ipp's...
r112 if not values or values[0] in ('', ' '):
return mark_safe(html)
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 for i, value in enumerate(values):
if not value:
continue
Juan C. Espinoza
Fix mix RC configurations for different ipp's...
r112 pk, mode, operation, delay, mask = value.split('|')
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 conf = RCConfiguration.objects.get(pk=pk)
if i==0:
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 html += '{:20.18}{:3}{:4}{:9}km{:>6}\r\n'.format(
Juan C. Espinoza
Fix mix RC configurations for different ipp's...
r112 conf.name,
mode,
Juan C. Espinoza
- Add sequence mode in mix configurations....
r116 ' ',
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 delay,
mask)
else:
Juan C. Espinoza
Fix mix RC configurations for different ipp's...
r112 html += '{:20.18}{:3}{:4}{:9}km{:>6}\r\n'.format(
conf.name,
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 mode,
Juan C. Espinoza
Fix mix RC configurations for different ipp's...
r112 operation,
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 delay,
mask)
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 return mark_safe(html)
def parse_mask(l):
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 values = []
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 for x in range(8):
if '{}'.format(x) in l:
values.append(1)
else:
values.append(0)
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 values.reverse()
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 return int(''.join([str(x) for x in values]), 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
Miguel Urco
Campaign has been added to RadarSys Model...
r13 def dev_confs(request):
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 page = request.GET.get('page')
order = ('type', 'device__device_type', 'experiment')
filters = request.GET.copy()
kwargs = get_paginator(Configuration, page, order, filters)
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 form = FilterForm(initial=request.GET, extra_fields=['tags','template'])
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 kwargs['keys'] = ['name', 'experiment', 'type', 'programmed_date']
Miguel Urco
sidebar_devices updated...
r14 kwargs['title'] = 'Configuration'
Miguel Urco
Campaign has been added to RadarSys Model...
r13 kwargs['suptitle'] = 'List'
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 kwargs['form'] = form
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 filters.pop('page', None)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 kwargs['q'] = urlencode(filters)
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 return render(request, 'base_list.html', kwargs)
Miguel Urco
Campaign has been added to RadarSys Model...
r13
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
Campaign has been added to RadarSys Model...
r13 def dev_conf(request, id_conf):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Views: Display "Page not found (404)" in case there is no object with the given pk....
r20 conf = get_object_or_404(Configuration, pk=id_conf)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
- Update rc app...
r79 return redirect(conf.get_absolute_url())
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
- Update rc app...
r79
def dev_conf_new(request, id_exp=0, id_dev=0):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
- Update rc app...
r79 initial = {}
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 kwargs = {}
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
if id_exp!=0:
Juan C. Espinoza
- Update rc app...
r79 initial['experiment'] = id_exp
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
if id_dev!=0:
Juan C. Espinoza
- Update rc app...
r79 initial['device'] = id_dev
Miguel Urco
Campaign has been added to RadarSys Model...
r13
if request.method == 'GET':
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 id_dev:
kwargs['button'] = 'Create'
Juan C. Espinoza
- Update rc app...
r79 device = Device.objects.get(pk=id_dev)
DevConfForm = CONF_FORMS[device.device_type.name]
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 initial['name'] = request.GET['name']
form = DevConfForm(initial=initial)
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 else:
if 'template' in request.GET:
if request.GET['template']=='0':
Juan C. Espinoza
- Improve display name for Devices & Configurations...
r121 choices = [(conf.pk, '{}'.format(conf)) for conf in Configuration.objects.filter(template=True)]
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 form = NewForm(initial={'create_from':2},
Juan C. Espinoza
- Improve display name for Devices & Configurations...
r121 template_choices=choices)
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 else:
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 kwargs['button'] = 'Create'
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 conf = Configuration.objects.get(pk=request.GET['template'])
Juan C. Espinoza
- Fix input form for delays in RCLine...
r119 id_dev = conf.device.pk
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 DevConfForm = CONF_FORMS[conf.device.device_type.name]
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 form = DevConfForm(instance=conf,
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 initial={'name': '{} [{:%Y/%m/%d}]'.format(conf.name, datetime.now()),
Juan C. Espinoza
- Add sequence mode in mix configurations....
r116 'template': False,
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 'experiment':id_exp})
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 elif 'blank' in request.GET:
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 kwargs['button'] = 'Create'
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 form = ConfigurationForm(initial=initial)
else:
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 form = NewForm()
Juan C. Espinoza
Updating base models and views ...
r6 if request.method == 'POST':
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
- Update rc app...
r79 device = Device.objects.get(pk=request.POST['device'])
Miguel Urco
template attribute added to RadarSys Models...
r47 DevConfForm = CONF_FORMS[device.device_type.name]
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
- Update rc app...
r79 form = DevConfForm(request.POST)
Fiorella Quino
Task #99: Modulo web del JARS + kwargs['button'] (main)...
r122 kwargs['button'] = 'Create'
Juan C. Espinoza
Updating base models and views ...
r6 if form.is_valid():
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 conf = form.save()
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 'template' in request.GET and conf.device.device_type.name=='rc':
Juan C. Espinoza
- Add sequence mode in mix configurations....
r116 lines = RCLine.objects.filter(rc_configuration=request.GET['template'])
Juan C. Espinoza
Update main app (view to mix RC configurations)...
r106 for line in lines:
line.clone(rc_configuration=conf)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
if conf.device.device_type.name=='jars':
Fiorella Quino
git-svn-id: http://jro-dev.igp.gob.pe/svn/jro_hard/radarsys/trunk/webapp@158 aa17d016-51d5-4e8b-934c-7b2bbb1bbe71
r137 conf.add_parms_to_filter()
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
return redirect('url_dev_conf', id_conf=conf.pk)
Juan C. Espinoza
- Update rc app...
r79 kwargs['id_exp'] = id_exp
Juan C. Espinoza
Updating base models and views ...
r6 kwargs['form'] = form
Miguel Urco
Campaign has been added to RadarSys Model...
r13 kwargs['title'] = 'Configuration'
Juan C. Espinoza
Updating base models and views ...
r6 kwargs['suptitle'] = 'New'
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
DDS new conf: default values (dev_conf_edit.html) (views.py)...
r99 if id_dev != 0:
device = Device.objects.get(pk=id_dev)
Juan C. Espinoza
- Fix input form for delays in RCLine...
r119 kwargs['device'] = device.device_type.name
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 return render(request, 'dev_conf_edit.html', kwargs)
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
views name were changed ...
r19 def dev_conf_edit(request, id_conf):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Views: Display "Page not found (404)" in case there is no object with the given pk....
r20 conf = get_object_or_404(Configuration, pk=id_conf)
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 DevConfForm = CONF_FORMS[conf.device.device_type.name]
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 if request.method=='GET':
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 form = DevConfForm(instance=conf)
Miguel Urco
Campaign has been added to RadarSys Model...
r13 if request.method=='POST':
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 form = DevConfForm(request.POST, instance=conf)
Miguel Urco
Campaign has been added to RadarSys Model...
r13 if form.is_valid():
form.save()
return redirect('url_dev_conf', id_conf=id_conf)
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 kwargs = {}
kwargs['form'] = form
kwargs['title'] = 'Device Configuration'
kwargs['suptitle'] = 'Edit'
kwargs['button'] = 'Update'
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Buttons "Import", "Export, "Read" and "Write" added to Configuration View...
r30 ###### SIDEBAR ######
Juan C. Espinoza
Update several views and models in main app...
r85 kwargs.update(sidebar(conf=conf))
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
Update new and edit "views"...
r91 return render(request, '%s_conf_edit.html' % conf.device.device_type.name, kwargs)
Miguel Urco
Campaign has been added to RadarSys Model...
r13
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
Models changed:...
r53 def dev_conf_start(request, id_conf):
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 conf = get_object_or_404(Configuration, pk=id_conf)
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 if conf.start_device():
messages.success(request, conf.message)
else:
messages.error(request, conf.message)
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 conf.status_device()
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 return redirect(conf.get_absolute_url())
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
Models changed:...
r53 def dev_conf_stop(request, id_conf):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Buttons "Import", "Export, "Read" and "Write" added to Configuration View...
r30 conf = get_object_or_404(Configuration, pk=id_conf)
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 if conf.stop_device():
messages.success(request, conf.message)
else:
messages.error(request, conf.message)
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 conf.status_device()
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 return redirect(conf.get_absolute_url())
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
Models changed:...
r53 def dev_conf_status(request, id_conf):
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 conf = get_object_or_404(Configuration, pk=id_conf)
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 if conf.status_device():
messages.success(request, conf.message)
else:
messages.error(request, conf.message)
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 return redirect(conf.get_absolute_url())
Miguel Urco
Buttons "Import", "Export, "Read" and "Write" added to Configuration View...
r30
def dev_conf_write(request, id_conf):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Buttons "Import", "Export, "Read" and "Write" added to Configuration View...
r30 conf = get_object_or_404(Configuration, pk=id_conf)
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 answer = conf.write_device()
Miguel Urco
DDS commands working...
r57 conf.status_device()
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 if answer:
messages.success(request, conf.message)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
#Creating a historical configuration
Juan C. Espinoza
sync repo...
r157 conf.clone(type=1, template=False)
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 #Original configuration
conf = DevConfModel.objects.get(pk=id_conf)
Miguel Urco
Models changed:...
r53 else:
messages.error(request, conf.message)
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 return redirect(conf.get_absolute_url())
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
Models changed:...
r53 def dev_conf_read(request, id_conf):
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 conf = get_object_or_404(Configuration, pk=id_conf)
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 DevConfForm = CONF_FORMS[conf.device.device_type.name]
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 if request.method=='GET':
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 parms = conf.read_device()
Miguel Urco
DDS commands working...
r57 conf.status_device()
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 if not parms:
messages.error(request, conf.message)
return redirect(conf.get_absolute_url())
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 form = DevConfForm(initial=parms, instance=conf)
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 if request.method=='POST':
form = DevConfForm(request.POST, instance=conf)
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 if form.is_valid():
Miguel Urco
DDS commands working...
r57 form.save()
return redirect(conf.get_absolute_url())
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 messages.error(request, "Parameters could not be saved")
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 kwargs = {}
kwargs['id_dev'] = conf.id
kwargs['form'] = form
kwargs['title'] = 'Device Configuration'
kwargs['suptitle'] = 'Parameters read from device'
kwargs['button'] = 'Save'
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 ###### SIDEBAR ######
Juan C. Espinoza
Update several views and models in main app...
r85 kwargs.update(sidebar(conf=conf))
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 return render(request, '%s_conf_edit.html' %conf.device.device_type.name, kwargs)
Miguel Urco
Buttons "Import", "Export, "Read" and "Write" added to Configuration View...
r30
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
Buttons "Import", "Export, "Read" and "Write" added to Configuration View...
r30 def dev_conf_import(request, id_conf):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Buttons "Import", "Export, "Read" and "Write" added to Configuration View...
r30 conf = get_object_or_404(Configuration, pk=id_conf)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 DevConfForm = CONF_FORMS[conf.device.device_type.name]
Miguel Urco
Models changed:...
r53 if request.method == 'GET':
file_form = UploadFileForm()
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 if request.method == 'POST':
file_form = UploadFileForm(request.POST, request.FILES)
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 if file_form.is_valid():
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 parms = conf.import_from_file(request.FILES['file'])
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 if parms:
messages.success(request, "Parameters imported from: '%s'." %request.FILES['file'].name)
form = DevConfForm(initial=parms, instance=conf)
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 kwargs = {}
kwargs['id_dev'] = conf.id
kwargs['form'] = form
kwargs['title'] = 'Device Configuration'
kwargs['suptitle'] = 'Parameters imported'
kwargs['button'] = 'Save'
kwargs['action'] = conf.get_absolute_url_edit()
kwargs['previous'] = conf.get_absolute_url()
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 ###### SIDEBAR ######
Juan C. Espinoza
Update several views and models in main app...
r85 kwargs.update(sidebar(conf=conf))
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
- Update rc app...
r79 return render(request, '%s_conf_edit.html' % conf.device.device_type.name, kwargs)
Miguel Urco
Models changed:...
r53
messages.error(request, "Could not import parameters from file")
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 kwargs = {}
kwargs['id_dev'] = conf.id
kwargs['title'] = 'Device Configuration'
kwargs['form'] = file_form
kwargs['suptitle'] = 'Importing file'
kwargs['button'] = 'Import'
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 kwargs.update(sidebar(conf=conf))
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 return render(request, 'dev_conf_import.html', kwargs)
Miguel Urco
Buttons "Import", "Export, "Read" and "Write" added to Configuration View...
r30
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
Buttons "Import", "Export, "Read" and "Write" added to Configuration View...
r30 def dev_conf_export(request, id_conf):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Buttons "Import", "Export, "Read" and "Write" added to Configuration View...
r30 conf = get_object_or_404(Configuration, pk=id_conf)
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 if request.method == 'GET':
Miguel Urco
DDS commands working...
r57 file_form = DownloadFileForm(conf.device.device_type.name)
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 if request.method == 'POST':
Miguel Urco
DDS commands working...
r57 file_form = DownloadFileForm(conf.device.device_type.name, request.POST)
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 if file_form.is_valid():
Miguel Urco
DDS commands working...
r57 fields = conf.export_to_file(format = file_form.cleaned_data['format'])
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 response = HttpResponse(content_type=fields['content_type'])
response['Content-Disposition'] = 'attachment; filename="%s"' %fields['filename']
response.write(fields['content'])
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 return response
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 messages.error(request, "Could not export 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 kwargs = {}
kwargs['id_dev'] = conf.id
kwargs['title'] = 'Device Configuration'
kwargs['form'] = file_form
kwargs['suptitle'] = 'Exporting file'
kwargs['button'] = 'Export'
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 return render(request, 'dev_conf_export.html', kwargs)
Miguel Urco
Buttons "Import", "Export, "Read" and "Write" added to Configuration View...
r30
Juan C. Espinoza
Update views and templates of main app...
r89
Miguel Urco
views name were changed ...
r19 def dev_conf_delete(request, id_conf):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
Views: Display "Page not found (404)" in case there is no object with the given pk....
r20 conf = get_object_or_404(Configuration, pk=id_conf)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Miguel Urco
delete interface added to views...
r18 if request.method=='POST':
if request.user.is_staff:
conf.delete()
Juan C. Espinoza
Update new and edit "views"...
r91 return redirect('url_dev_confs')
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
Update new and edit "views"...
r91 messages.error(request, 'Not enough permission to delete this object')
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 return redirect(conf.get_absolute_url())
Juan C. Espinoza
Update new and edit "views"...
r91 kwargs = {
'title': 'Delete',
'suptitle': 'Experiment',
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 'object': conf,
Juan C. Espinoza
Update new and edit "views"...
r91 'previous': conf.get_absolute_url(),
'delete': True
}
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Juan C. Espinoza
Update new and edit "views"...
r91 return render(request, 'confirm.html', kwargs)
Juan C. Espinoza
Updates to models, views & forms for CR...
r25
Juan C. Espinoza
Update several views and models in main app...
r85
def sidebar(**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 side_data = {}
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 conf = kwargs.get('conf', None)
experiment = kwargs.get('experiment', None)
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 not experiment:
experiment = conf.experiment
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 experiment:
side_data['experiment'] = experiment
campaign = experiment.campaign_set.all()
if campaign:
side_data['campaign'] = campaign[0]
experiments = campaign[0].experiments.all()
else:
experiments = [experiment]
configurations = experiment.configuration_set.filter(type=0)
side_data['side_experiments'] = experiments
side_data['side_configurations'] = configurations
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 return side_data
Juan C. Espinoza
Update base template: main menu...
r46
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 def get_paginator(model, page, order, filters={}, n=10):
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 kwargs = {}
query = Q()
if isinstance(filters, QueryDict):
filters = filters.dict()
[filters.pop(key) for key in filters.keys() if filters[key] in ('', ' ')]
filters.pop('page', None)
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 if 'start_date' in filters:
filters['start_date__gte'] = filters.pop('start_date')
if 'end_date' in filters:
filters['start_date__lte'] = filters.pop('end_date')
if 'tags' in filters:
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 tags = filters.pop('tags')
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 if 'tags' in model._meta.get_all_field_names():
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 query = query | Q(tags__icontains=tags)
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 if 'name' in model._meta.get_all_field_names():
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 query = query | Q(name__icontains=tags)
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 if 'location' in model._meta.get_all_field_names():
query = query | Q(location__name__icontains=tags)
if 'device' in model._meta.get_all_field_names():
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 query = query | Q(device__name__icontains=tags)
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138
object_list = model.objects.filter(query, **filters).order_by(*order)
paginator = Paginator(object_list, n)
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 try:
objects = paginator.page(page)
except PageNotAnInteger:
objects = paginator.page(1)
except EmptyPage:
objects = paginator.page(paginator.num_pages)
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 kwargs['objects'] = objects
kwargs['offset'] = (int(page)-1)*n if page else 0
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 return kwargs
Juan C. Espinoza
Update base template: main menu...
r46
Fiorella Quino
Task #487: Vista de Operacion...
r50 def operation(request, id_camp=None):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
kwargs = {}
campaigns = Campaign.objects.filter(start_date__lte=datetime.now(),
end_date__gte=datetime.now()).order_by('-start_date')
Fiorella Quino
Task #487: Vista de Operacion...
r50
Miguel Urco
Models changed:...
r53
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 if id_camp:
campaign = get_object_or_404(Campaign, pk = id_camp)
form = OperationForm(initial={'campaign': campaign.id}, campaigns=campaigns)
kwargs['campaign'] = campaign
else:
form = OperationForm(campaigns=campaigns)
kwargs['form'] = form
return render(request, 'operation.html', kwargs)
Miguel Urco
Models changed:...
r53
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 #---Experiment
Fiorella Quino
Task #487: Vista Operation segun nuevo modelo....
r81 keys = ['id', 'name', 'start_time', 'end_time', 'status']
Fiorella Quino
Task #487: Vista de Operacion...
r50 kwargs['experiment_keys'] = keys[1:]
kwargs['experiments'] = experiments
#---Radar
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 kwargs['locations'] = campaign.get_experiments_by_location()
print kwargs['locations']
Fiorella Quino
Task #487: Vista de Operacion...
r50 #---Else
Miguel Urco
Models changed:...
r53 kwargs['title'] = 'Campaign'
Fiorella Quino
Task #487: Vista de Operacion...
r50 kwargs['suptitle'] = campaign.name
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 kwargs['form'] = form
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 return render(request, 'operation.html', kwargs)
Juan C. Espinoza
Update views and templates of main app...
r89
Fiorella Quino
Task #487: Operation. Views: radar_play y radar_stop. Models: RunningExperiment. Attributes: status. Methods: get_status(), status_color()...
r84 def operation_search(request, id_camp=None):
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 if not id_camp:
campaigns = Campaign.objects.all().order_by('-start_date')
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 if not campaigns:
return render(request, 'operation.html', {})
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 id_camp = campaigns[0].id
Fiorella Quino
Task #487: Operation. Views: radar_play y radar_stop. Models: RunningExperiment. Attributes: status. Methods: get_status(), status_color()...
r84 campaign = get_object_or_404(Campaign, pk = id_camp)
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. Views: radar_play y radar_stop. Models: RunningExperiment. Attributes: status. Methods: get_status(), status_color()...
r84 if request.method=='GET':
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 form = OperationSearchForm(initial={'campaign': campaign.id})
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 if request.method=='POST':
form = OperationSearchForm(request.POST, initial={'campaign':campaign.id})
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 if form.is_valid():
Fiorella Quino
Task #487: Operation. Views: radar_play y radar_stop. Models: RunningExperiment. Attributes: status. Methods: get_status(), status_color()...
r84 return redirect('url_operation', id_camp=campaign.id)
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. Views: radar_play y radar_stop. Models: RunningExperiment. Attributes: status. Methods: get_status(), status_color()...
r84 #locations = Location.objects.filter(experiment__campaign__pk = campaign.id).distinct()
experiments = Experiment.objects.filter(campaign__pk=campaign.id)
Fiorella Quino
Task 487: Operation View gets status from database and radar_refresh button updates status...
r88 #for exs in experiments:
# exs.get_status()
Fiorella Quino
Task #487: Operation. Views: radar_play y radar_stop. Models: RunningExperiment. Attributes: status. Methods: get_status(), status_color()...
r84 locations= Location.objects.filter(experiment=experiments).distinct()
form = OperationSearchForm(initial={'campaign': campaign.id})
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. Views: radar_play y radar_stop. Models: RunningExperiment. Attributes: status. Methods: get_status(), status_color()...
r84 kwargs = {}
#---Campaign
kwargs['campaign'] = campaign
kwargs['campaign_keys'] = ['name', 'start_date', 'end_date', 'tags', 'description']
#---Experiment
keys = ['id', 'name', 'start_time', 'end_time', 'status']
kwargs['experiment_keys'] = keys[1:]
kwargs['experiments'] = experiments
#---Radar
kwargs['locations'] = locations
#---Else
kwargs['title'] = 'Campaign'
kwargs['suptitle'] = campaign.name
kwargs['form'] = form
kwargs['button'] = 'Select'
kwargs['details'] = True
kwargs['search_button'] = False
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. Views: radar_play y radar_stop. Models: RunningExperiment. Attributes: status. Methods: get_status(), status_color()...
r84 return render(request, 'operation.html', kwargs)
def radar_play(request, id_camp, id_radar):
Fiorella Quino
Task 487: Operation View gets status from database and radar_refresh button updates status...
r88 campaign = get_object_or_404(Campaign, pk = id_camp)
radar = get_object_or_404(Location, pk = id_radar)
Fiorella Quino
Task # 487: Operation View: radar_play...
r90 today = datetime.today()
now = today.time()
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: radar_play. Clear Old Experiments from Running Experiment Object...
r93 #--Clear Old Experiments From RunningExperiment Object
Fiorella Quino
Task # 487: Operation View: objects.get -> objects.filter...
r95 running_experiment = RunningExperiment.objects.filter(radar=radar)
Fiorella Quino
Task # 487: Operation View: radar_play. Clear Old Experiments from Running Experiment Object...
r93 if running_experiment:
Fiorella Quino
Task # 487: Operation View: objects.get -> objects.filter...
r95 running_experiment = running_experiment[0]
Fiorella Quino
Task # 487: Operation View: radar_play. Clear Old Experiments from Running Experiment Object...
r93 running_experiment.running_experiment.clear()
running_experiment.save()
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: radar_play...
r90 #--If campaign datetime is ok:
if today >= campaign.start_date and today <= campaign.end_date:
experiments = Experiment.objects.filter(campaign=campaign).filter(location=radar)
for exp in experiments:
#--If experiment time is ok:
if now >= exp.start_time and now <= exp.end_time:
configurations = Configuration.objects.filter(experiment = exp)
for conf in configurations:
if 'cgs' in conf.device.device_type.name:
conf.status_device()
else:
answer = conf.start_device()
conf.status_device()
#--Running Experiment
Fiorella Quino
Task # 487: Operation View: objects.get -> objects.filter...
r95 old_running_experiment = RunningExperiment.objects.filter(radar=radar)
Fiorella Quino
Task # 487: Operation View: radar_play...
r90 #--If RunningExperiment element exists
Fiorella Quino
Task # 487: Operation View: radar_play. Clear Old Experiments from Running Experiment Object...
r93 if old_running_experiment:
Fiorella Quino
Task # 487: Operation View: objects.get -> objects.filter...
r95 old_running_experiment = old_running_experiment[0]
Fiorella Quino
Task # 487: Operation View: radar_play. Clear Old Experiments from Running Experiment Object...
r93 old_running_experiment.running_experiment.add(exp)
old_running_experiment.status = 3
old_running_experiment.save()
#--Create a new Running_Experiment Object
Fiorella Quino
Task # 487: Operation View: radar_play...
r90 else:
Fiorella Quino
Task # 487: Operation View: radar_play. Clear Old Experiments from Running Experiment Object...
r93 new_running_experiment = RunningExperiment(
Fiorella Quino
Task # 487: Operation View: radar_play...
r90 radar = radar,
status = 3,
)
Fiorella Quino
Task # 487: Operation View: radar_play. Clear Old Experiments from Running Experiment Object...
r93 new_running_experiment.save()
new_running_experiment.running_experiment.add(exp)
new_running_experiment.save()
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: radar_play...
r90 if answer:
messages.success(request, conf.message)
exp.status=2
exp.save()
else:
messages.error(request, conf.message)
else:
if exp.status == 1 or exp.status == 3:
exp.status=3
exp.save()
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. Views: radar_play y radar_stop. Models: RunningExperiment. Attributes: status. Methods: get_status(), status_color()...
r84 route = request.META['HTTP_REFERER']
route = str(route)
if 'search' in route:
return HttpResponseRedirect(reverse('url_operation_search', args=[id_camp]))
else:
return HttpResponseRedirect(reverse('url_operation', args=[id_camp]))
Fiorella Quino
Task 487: Operation View gets status from database and radar_refresh button updates status...
r88
Fiorella Quino
Task #487: Operation. Views: radar_play y radar_stop. Models: RunningExperiment. Attributes: status. Methods: get_status(), status_color()...
r84 def radar_stop(request, id_camp, id_radar):
Fiorella Quino
Task # 487: Operation View: radar_play. Clear Old Experiments from Running Experiment Object...
r93 campaign = get_object_or_404(Campaign, pk = id_camp)
radar = get_object_or_404(Location, pk = id_radar)
Fiorella Quino
Task # 487: Operation View: radar_stop with "stop_device()" function ...
r94 experiments = Experiment.objects.filter(campaign=campaign).filter(location=radar)
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: radar_stop with "stop_device()" function ...
r94 for exp in experiments:
configurations = Configuration.objects.filter(experiment = exp)
for conf in configurations:
if 'cgs' in conf.device.device_type.name:
conf.status_device()
else:
answer = conf.stop_device()
conf.status_device()
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: radar_stop with "stop_device()" function ...
r94 if answer:
messages.success(request, conf.message)
exp.status=1
exp.save()
else:
messages.error(request, conf.message)
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
Fiorella Quino
Task #487: Operation. Views: radar_play y radar_stop. Models: RunningExperiment. Attributes: status. Methods: get_status(), status_color()...
r84 route = request.META['HTTP_REFERER']
route = str(route)
if 'search' in route:
return HttpResponseRedirect(reverse('url_operation_search', args=[id_camp]))
else:
Juan C. Espinoza
Update several views and models in main app...
r85 return HttpResponseRedirect(reverse('url_operation', args=[id_camp]))
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 gets status from database and radar_refresh button updates status...
r88
def radar_refresh(request, id_camp, id_radar):
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 gets status from database and radar_refresh button updates status...
r88 campaign = get_object_or_404(Campaign, pk = id_camp)
radar = get_object_or_404(Location, pk = id_radar)
experiments = Experiment.objects.filter(campaign=campaign).filter(location=radar)
for exs in experiments:
exs.get_status()
route = request.META['HTTP_REFERER']
route = str(route)
if 'search' in route:
return HttpResponseRedirect(reverse('url_operation_search', args=[id_camp]))
else:
return HttpResponseRedirect(reverse('url_operation', args=[id_camp]))
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172