##// END OF EJS Templates
Campaign has been added to RadarSys Model...
Campaign has been added to RadarSys Model git-svn-id: http://jro-dev.igp.gob.pe/svn/jro_hard/radarsys/trunk/webapp@27 aa17d016-51d5-4e8b-934c-7b2bbb1bbe71

File last commit:

r13:6a2dde2f45c9
r13:6a2dde2f45c9
Show More
views.py
53 lines | 1.7 KiB | text/x-python | PythonLexer
Fiorella Quino
CGS model, form, view, url and html have been added....
r4 from django.shortcuts import render, render_to_response
from django.template import RequestContext
from .forms import CGSConfigurationForm
Juan C. Espinoza
Updating base models and views ...
r6 from .models import CGSConfiguration
from apps.main.models import Device
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
Juan C. Espinoza
Updating base models and views ...
r6 def configurate_frequencies(request, id=0):
Miguel Urco
Campaign has been added to RadarSys Model...
r13
Juan C. Espinoza
Updating base models and views ...
r6 if id:
conf = CGSConfiguration.objects.get(pk=id)
devices = Device.objects.filter(configuration__experiment=conf.experiment)
Miguel Urco
Campaign has been added to RadarSys Model...
r13 devices = devices.values('configuration__id', 'device_type__name')
Juan C. Espinoza
Updating base models and views ...
r6 for device in devices:
Miguel Urco
Campaign has been added to RadarSys Model...
r13 if device['device_type__name']=='cgs':
Juan C. Espinoza
Updating base models and views ...
r6 device['active'] = 'active'
Miguel Urco
CGS view updated...
r11 break
device = device
Juan C. Espinoza
Updating base models and views ...
r6 form = CGSConfigurationForm(instance=conf)
else:
form = CGSConfigurationForm()
Fiorella Quino
CGS model, form, view, url and html have been added....
r4
data = {
'form': form,
Miguel Urco
CGS view updated...
r11 'device': device,
Juan C. Espinoza
Updating base models and views ...
r6 'devices':devices,
Fiorella Quino
CGS model, form, view, url and html have been added....
r4 'title': ('YAP'),
Miguel Urco
Campaign has been added to RadarSys Model...
r13 'experiment': conf.experiment,
Miguel Urco
CGS view updated...
r11
Fiorella Quino
CGS model, form, view, url and html have been added....
r4 }
Fiorella Quino
SIR Task #95 Modelo CGS: ...
r8
Miguel Urco
Campaign has been added to RadarSys Model...
r13 data['dev_conf'] = conf
data['dev_conf_keys'] = ['experiment', 'device']
Fiorella Quino
SIR Task #95 Modelo CGS: ...
r8 if request.method == 'POST':
form = CGSConfigurationForm(request.POST) #, initial={'purchase_request':purchase_request})
if form.is_valid():
instance = form.save(commit=False)
#if 'quote' in request.FILES:
# instance.quoe = request.FILES['quote']
instance.save()
form.save_m2m()
msg = _(u'The frequencies have been activated successfully.')
messages.success(request, msg, fail_silently=True)
#return redirect(purchase_request.get_absolute_url())
else:
form = CGSConfigurationForm()
Miguel Urco
Campaign has been added to RadarSys Model...
r13 return render(request, 'cgs_conf.html', data)
Fiorella Quino
CGS model, form, view, url and html have been added....
r4