@@ -264,20 +264,33 def send_beam(request, id_conf, id_beam): | |||
|
264 | 264 | return redirect(conf.get_absolute_url()) |
|
265 | 265 | |
|
266 | 266 | beam = get_object_or_404(ABSBeam, pk=id_beam) |
|
267 | beams_list = ABSBeam.objects.filter(abs_conf=conf) | |
|
268 | conf.active_beam = id_beam | |
|
269 | 267 | |
|
270 | i = 0 | |
|
271 | for b in beams_list: | |
|
272 | if b.id == int(id_beam): | |
|
273 | break | |
|
274 | else: | |
|
275 |
|
|
|
276 | beam_pos = i + 1 #Estandarizar | |
|
277 | print '%s Position: %s' % (beam.name, str(beam_pos)) | |
|
278 | conf.send_beam(beam_pos) | |
|
268 | if request.method == 'POST': | |
|
269 | ||
|
270 | beams_list = ABSBeam.objects.filter(abs_conf=conf) | |
|
271 | conf.active_beam = id_beam | |
|
272 | ||
|
273 | i = 0 | |
|
274 | for b in beams_list: | |
|
275 | if b.id == int(id_beam): | |
|
276 | break | |
|
277 | else: | |
|
278 | i += 1 | |
|
279 | beam_pos = i + 1 #Estandarizar | |
|
280 | print '%s Position: %s' % (beam.name, str(beam_pos)) | |
|
281 | conf.send_beam(beam_pos) | |
|
282 | ||
|
283 | return redirect('url_abs_conf', conf.id) | |
|
284 | ||
|
285 | kwargs = { | |
|
286 | 'title': 'ABS', | |
|
287 | 'suptitle': conf.label, | |
|
288 | 'message': 'Are you sure you want to change ABS Beam to: {}?'.format(beam.name), | |
|
289 | 'delete': False | |
|
290 | } | |
|
291 | kwargs['menu_configurations'] = 'active' | |
|
279 | 292 | |
|
280 | return redirect('url_abs_conf', conf.id) | |
|
293 | return render(request, 'confirm.html', kwargs) | |
|
281 | 294 | |
|
282 | 295 | |
|
283 | 296 | def add_beam(request, id_conf): |
@@ -1492,16 +1492,27 def dev_conf_write(request, id_conf): | |||
|
1492 | 1492 | |
|
1493 | 1493 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
1494 | 1494 | |
|
1495 | if conf.write_device(): | |
|
1496 | conf.device.conf_active = conf.pk | |
|
1497 |
conf.device. |
|
|
1498 | messages.success(request, conf.message) | |
|
1499 | if has_been_modified(conf): | |
|
1500 | conf.clone(type=1, template=False) | |
|
1501 | else: | |
|
1502 | messages.error(request, conf.message) | |
|
1495 | if request.method == 'POST': | |
|
1496 | if conf.write_device(): | |
|
1497 | conf.device.conf_active = conf.pk | |
|
1498 | conf.device.save() | |
|
1499 | messages.success(request, conf.message) | |
|
1500 | if has_been_modified(conf): | |
|
1501 | conf.clone(type=1, template=False) | |
|
1502 | else: | |
|
1503 | messages.error(request, conf.message) | |
|
1503 | 1504 | |
|
1504 | return redirect(get_object_or_404(Configuration, pk=id_conf).get_absolute_url()) | |
|
1505 | return redirect(get_object_or_404(Configuration, pk=id_conf).get_absolute_url()) | |
|
1506 | ||
|
1507 | kwargs = { | |
|
1508 | 'title': 'Write Configuration', | |
|
1509 | 'suptitle': conf.label, | |
|
1510 | 'message': 'Are you sure yo want to write this {} configuration?'.format(conf.device), | |
|
1511 | 'delete': False | |
|
1512 | } | |
|
1513 | kwargs['menu_configurations'] = 'active' | |
|
1514 | ||
|
1515 | return render(request, 'confirm.html', kwargs) | |
|
1505 | 1516 | |
|
1506 | 1517 | |
|
1507 | 1518 | @login_required |
General Comments 0
You need to be logged in to leave comments.
Login now