##// END OF EJS Templates
Update Views y several improvements
Update Views y several improvements

File last commit:

r316:0d39f71bbf42
r316:0d39f71bbf42
Show More
views.py
74 lines | 2.1 KiB | text/x-python | PythonLexer
Miguel Urco
DDS model added...
r12 # Create your views here.
Miguel Urco
Views: Display "Page not found (404)" in case there is no object with the given pk....
r20 from django.shortcuts import redirect, render, get_object_or_404
Juan C. Espinoza
Proyecto base en Django (refs #259) ...
r0
Miguel Urco
Buttons "Import", "Export, "Read" and "Write" added to Configuration View...
r30 # from apps.main.models import Experiment, Configuration
Miguel Urco
git-svn-id: http://jro-dev.igp.gob.pe/svn/jro_hard/radarsys/trunk/webapp@44 aa17d016-51d5-4e8b-934c-7b2bbb1bbe71
r26 from apps.main.views import sidebar
Miguel Urco
DDS model added...
r12 from .models import DDSConfiguration
Miguel Urco
DDS model updated...
r55 from .forms import DDSConfigurationForm
Juan C. Espinoza
Proyecto base en Django (refs #259) ...
r0 # Create your views here.
Miguel Urco
DDS model added...
r12
Miguel Urco
Campaign has been added to RadarSys Model...
r13 def dds_conf(request, id_conf):
Miguel Urco
DDS model added...
r12
Miguel Urco
Views: Display "Page not found (404)" in case there is no object with the given pk....
r20 conf = get_object_or_404(DDSConfiguration, pk=id_conf)
Fiorella Quino
DDS files have been updated...
r262
Miguel Urco
Campaign has been added to RadarSys Model...
r13 kwargs = {}
Fiorella Quino
DDS files have been updated...
r262
Miguel Urco
DDS commands working...
r57 kwargs['status'] = conf.device.get_status_display()
Fiorella Quino
DDS files have been updated...
r262
Miguel Urco
DDS model updated...
r55 # if not kwargs['connected']:
# messages.error(request, message=answer)
Fiorella Quino
DDS files have been updated...
r262
Miguel Urco
siderbar_devices.html updated...
r17 kwargs['dev_conf'] = conf
Juan C. Espinoza
Update Views y several improvements
r316 kwargs['dev_conf_keys'] = [
Miguel Urco
DDS model updated...
r55 'clock',
'multiplier',
'frequencyA_Mhz',
'frequencyA',
'frequencyB_Mhz',
'frequencyB',
'phaseA_degrees',
'phaseB_degrees',
Miguel Urco
Buttons "Import", "Export, "Read" and "Write" added to Configuration View...
r30 'modulation',
Miguel Urco
DDS model updated...
r55 'amplitude_enabled',
'amplitudeI',
'amplitudeQ']
Fiorella Quino
DDS files have been updated...
r262
Miguel Urco
Campaign has been added to RadarSys Model...
r13 kwargs['title'] = 'DDS Configuration'
kwargs['suptitle'] = 'Details'
Fiorella Quino
DDS files have been updated...
r262
Miguel Urco
Campaign has been added to RadarSys Model...
r13 kwargs['button'] = 'Edit Configuration'
Fiorella Quino
DDS files have been updated...
r262
Miguel Urco
siderbar_devices.html updated...
r17 ###### SIDEBAR ######
Juan C. Espinoza
Update several views and models in main app...
r85 kwargs.update(sidebar(conf=conf))
Fiorella Quino
DDS files have been updated...
r262
Miguel Urco
Campaign has been added to RadarSys Model...
r13 return render(request, 'dds_conf.html', kwargs)
Fiorella Quino
DDS files have been updated...
r262
Miguel Urco
views name were changed ...
r19 def dds_conf_edit(request, id_conf):
Fiorella Quino
DDS files have been updated...
r262
Miguel Urco
Views: Display "Page not found (404)" in case there is no object with the given pk....
r20 conf = get_object_or_404(DDSConfiguration, pk=id_conf)
Fiorella Quino
DDS files have been updated...
r262
Miguel Urco
Campaign has been added to RadarSys Model...
r13 if request.method=='GET':
Miguel Urco
siderbar_devices.html updated...
r17 form = DDSConfigurationForm(instance=conf)
Fiorella Quino
DDS files have been updated...
r262
Miguel Urco
Campaign has been added to RadarSys Model...
r13 if request.method=='POST':
Miguel Urco
siderbar_devices.html updated...
r17 form = DDSConfigurationForm(request.POST, instance=conf)
Fiorella Quino
DDS files have been updated...
r262
Miguel Urco
DDS model added...
r12 if form.is_valid():
Miguel Urco
git-svn-id: http://jro-dev.igp.gob.pe/svn/jro_hard/radarsys/trunk/webapp@44 aa17d016-51d5-4e8b-934c-7b2bbb1bbe71
r26 conf = form.save(commit=False)
Fiorella Quino
DDS files have been updated...
r262
Miguel Urco
git-svn-id: http://jro-dev.igp.gob.pe/svn/jro_hard/radarsys/trunk/webapp@44 aa17d016-51d5-4e8b-934c-7b2bbb1bbe71
r26 if conf.verify_frequencies():
Fiorella Quino
DDS files have been updated...
r262
Miguel Urco
git-svn-id: http://jro-dev.igp.gob.pe/svn/jro_hard/radarsys/trunk/webapp@44 aa17d016-51d5-4e8b-934c-7b2bbb1bbe71
r26 conf.save()
return redirect('url_dds_conf', id_conf=conf.id)
Fiorella Quino
DDS files have been updated...
r262
Miguel Urco
git-svn-id: http://jro-dev.igp.gob.pe/svn/jro_hard/radarsys/trunk/webapp@44 aa17d016-51d5-4e8b-934c-7b2bbb1bbe71
r26 ##ERRORS
Fiorella Quino
DDS files have been updated...
r262
Miguel Urco
Campaign has been added to RadarSys Model...
r13 kwargs = {}
Miguel Urco
git-svn-id: http://jro-dev.igp.gob.pe/svn/jro_hard/radarsys/trunk/webapp@44 aa17d016-51d5-4e8b-934c-7b2bbb1bbe71
r26 kwargs['id_dev'] = conf.id
Miguel Urco
Campaign has been added to RadarSys Model...
r13 kwargs['form'] = form
kwargs['title'] = 'Device Configuration'
kwargs['suptitle'] = 'Edit'
Miguel Urco
git-svn-id: http://jro-dev.igp.gob.pe/svn/jro_hard/radarsys/trunk/webapp@44 aa17d016-51d5-4e8b-934c-7b2bbb1bbe71
r26 kwargs['button'] = 'Save'
Fiorella Quino
DDS files have been updated...
r262 return render(request, 'dds_conf_edit.html', kwargs)