views.py
35 lines
| 970 B
| text/x-python
|
PythonLexer
|
r6 | from django.shortcuts import render_to_response | ||
from django.template import RequestContext | ||||
from apps.main.models import Device | ||||
|
r30 | from apps.main.views import sidebar | ||
|
r6 | from .models import JARSConfiguration | ||
from .forms import JARSConfigurationForm | ||||
# Create your views here. | ||||
def jars_config(request, id): | ||||
if id: | ||||
conf = JARSConfiguration.objects.get(pk=id) | ||||
devices = Device.objects.filter(configuration__experiment=conf.experiment) | ||||
|
r13 | devices = devices.values('configuration__id', 'device_type__name') | ||
|
r6 | for device in devices: | ||
|
r13 | if device['device_type__name']=='jars': | ||
|
r6 | device['active'] = 'active' | ||
|
r30 | # form = JARSConfigurationForm(instance=conf) | ||
# else: | ||||
# form = JARSConfigurationForm() | ||||
|
r6 | |||
kwargs = { | ||||
|
r14 | 'dev_conf': conf | ||
|
r6 | } | ||
|
r30 | ###### SIDEBAR ###### | ||
kwargs.update(sidebar(conf)) | ||||
|
r6 | return render_to_response('jars.html', kwargs, context_instance=RequestContext(request)) | ||