##// END OF EJS Templates
Add support to read abs module status
Add support to read abs module status

File last commit:

r261:fa895af951ee
r326:f70d4e6cdcb2
Show More
views.py
75 lines | 2.0 KiB | text/x-python | PythonLexer
Fiorella Quino
Task #95: views...
r27 from django.shortcuts import redirect, render, get_object_or_404
Fiorella Quino
Task #94: edit, save, read function...
r31 from django.contrib import messages
Fiorella Quino
Task #95: Se agrego funcion "export" archivo .json para cgs. Se modifico modelo de cgs, de float a integer...
r43 from django.http import HttpResponse
Fiorella Quino
CGS model, form, view, url and html have been added....
r4
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172 from apps.main.models import Experiment
Juan C. Espinoza
Updating base models and views ...
r6 from .models import CGSConfiguration
Fiorella Quino
Task #94: edit, save, read function...
r31
Fiorella Quino
Task #95: se agrego la funcion "import" para archivos .json ...
r42 from .forms import CGSConfigurationForm, UploadFileForm
Fiorella Quino
Task #94: edit, save, read function...
r31 from apps.main.views import sidebar
import requests
Fiorella Quino
Task #95...
r38 import json
Fiorella Quino
Task #95: Se modifico funcion "read"...
r39 #from __builtin__ import None
Juan C. Espinoza
Proyecto base en Django (refs #259) ...
r0 # Create your views here.
Fiorella Quino
CGS model, form, view, url and html have been added....
r4
Fiorella Quino
Task #95: views...
r27 def cgs_conf(request, id_conf):
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #95: views...
r27 conf = get_object_or_404(CGSConfiguration, pk=id_conf)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #94: edit, save, read function...
r31 ip=conf.device.ip_address
port=conf.device.port_address
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #95: views...
r27 kwargs = {}
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #95: Modulo CGS ...
r59 kwargs['status'] = conf.device.get_status_display()
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #95: views...
r27 kwargs['dev_conf'] = conf
Juan C. Espinoza
Improve Search view (filters and paginator added), add base_list template, delete unused templates...
r138 kwargs['dev_conf_keys'] = ['name',
Fiorella Quino
Task #95: views...
r27 'freq0', 'freq1',
'freq2', 'freq3']
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #95: views...
r27 kwargs['title'] = 'CGS Configuration'
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 #95: views...
r27 kwargs['button'] = 'Edit Configuration'
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Standardize cgs functions. Start and Stop functions have been implemented...
r208 #kwargs['no_play'] = True
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #95: views...
r27 ###### 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
Fiorella Quino
Task #95: views...
r27 return render(request, 'cgs_conf.html', kwargs)
Fiorella Quino
CGS model, form, view, url and html have been added....
r4
Fiorella Quino
Task #95: views...
r27 def cgs_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
Fiorella Quino
Task #95: views...
r27 conf = get_object_or_404(CGSConfiguration, pk=id_conf)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #95: views...
r27 if request.method=='GET':
form = CGSConfigurationForm(instance=conf)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #95: views...
r27 if request.method=='POST':
form = CGSConfigurationForm(request.POST, instance=conf)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
SIR Task #95 Modelo CGS: ...
r8 if form.is_valid():
Fiorella Quino
Task #95: Se agrego funcion "export" archivo .json para cgs. Se modifico modelo de cgs, de float a integer...
r43 if conf.freq0 == None: conf.freq0 = 0
if conf.freq1 == None: conf.freq1 = 0
if conf.freq2 == None: conf.freq2 = 0
if conf.freq3 == None: conf.freq3 = 0
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #94: edit, save, read function...
r31 conf = form.save(commit=False)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #94: edit, save, read function...
r31 if conf.verify_frequencies():
conf.save()
return redirect('url_cgs_conf', id_conf=conf.id)
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #94: edit, save, read function...
r31 ##ERRORS
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #95: views...
r27 kwargs = {}
Fiorella Quino
Task #94: edit, save, read function...
r31 kwargs['id_dev'] = conf.id
Fiorella Quino
Task #95: views...
r27 kwargs['form'] = form
kwargs['title'] = 'Device Configuration'
kwargs['suptitle'] = 'Edit'
Fiorella Quino
Task #94: edit, save, read function...
r31 kwargs['button'] = 'Save'
Juan C. Espinoza
Update code for django 1.10, python 3 and latest third party packages, review operation view ...
r172
Fiorella Quino
Task #94: edit, save, read function...
r31 return render(request, 'cgs_conf_edit.html', kwargs)