@@ -1048,8 +1048,24 def radar_play(request, id_camp, id_radar): | |||||
1048 | def radar_stop(request, id_camp, id_radar): |
|
1048 | def radar_stop(request, id_camp, id_radar): | |
1049 | campaign = get_object_or_404(Campaign, pk = id_camp) |
|
1049 | campaign = get_object_or_404(Campaign, pk = id_camp) | |
1050 | radar = get_object_or_404(Location, pk = id_radar) |
|
1050 | radar = get_object_or_404(Location, pk = id_radar) | |
1051 | today = datetime.today() |
|
1051 | experiments = Experiment.objects.filter(campaign=campaign).filter(location=radar) | |
1052 | now = today.time() |
|
1052 | ||
|
1053 | for exp in experiments: | |||
|
1054 | configurations = Configuration.objects.filter(experiment = exp) | |||
|
1055 | for conf in configurations: | |||
|
1056 | if 'cgs' in conf.device.device_type.name: | |||
|
1057 | conf.status_device() | |||
|
1058 | else: | |||
|
1059 | answer = conf.stop_device() | |||
|
1060 | conf.status_device() | |||
|
1061 | ||||
|
1062 | if answer: | |||
|
1063 | messages.success(request, conf.message) | |||
|
1064 | exp.status=1 | |||
|
1065 | exp.save() | |||
|
1066 | else: | |||
|
1067 | messages.error(request, conf.message) | |||
|
1068 | ||||
1053 |
|
1069 | |||
1054 | route = request.META['HTTP_REFERER'] |
|
1070 | route = request.META['HTTP_REFERER'] | |
1055 | route = str(route) |
|
1071 | route = str(route) |
General Comments 0
You need to be logged in to leave comments.
Login now