@@ -104,7 +104,8 class Device(models.Model): | |||
|
104 | 104 | db_table = 'db_devices' |
|
105 | 105 | |
|
106 | 106 | def __unicode__(self): |
|
107 | return u'%s | %s' % (self.name, self.ip_address) | |
|
107 | return u'[{}]: {}'.format(self.device_type.name.upper(), | |
|
108 | self.name) | |
|
108 | 109 | |
|
109 | 110 | def get_status(self): |
|
110 | 111 | return self.status |
@@ -303,7 +304,7 class Experiment(models.Model): | |||
|
303 | 304 | self.save() |
|
304 | 305 | |
|
305 | 306 | def status_color(self): |
|
306 |
color = 'd |
|
|
307 | color = 'muted' | |
|
307 | 308 | if self.status == 0: |
|
308 | 309 | color = "danger" |
|
309 | 310 | elif self.status == 1: |
@@ -312,8 +313,6 class Experiment(models.Model): | |||
|
312 | 313 | color = "success" |
|
313 | 314 | elif self.status == 3: |
|
314 | 315 | color = "warning" |
|
315 | else: | |
|
316 | color = "muted" | |
|
317 | 316 | |
|
318 | 317 | return color |
|
319 | 318 | |
@@ -452,7 +451,7 class Configuration(PolymorphicModel): | |||
|
452 | 451 | |
|
453 | 452 | def __unicode__(self): |
|
454 | 453 | |
|
455 |
return u'[ |
|
|
454 | return u'[{}]: {}'.format(self.device.device_type.name.upper(), self.name) | |
|
456 | 455 | |
|
457 | 456 | def clone(self, **kwargs): |
|
458 | 457 |
@@ -26,7 +26,6 from apps.dds.models import DDSConfiguration | |||
|
26 | 26 | |
|
27 | 27 | CONF_FORMS = { |
|
28 | 28 | 'rc': RCConfigurationForm, |
|
29 | 'rc_mix': RCMixConfigurationForm, | |
|
30 | 29 | 'dds': DDSConfigurationForm, |
|
31 | 30 | 'jars': JARSConfigurationForm, |
|
32 | 31 | 'cgs': CGSConfigurationForm, |
@@ -495,7 +494,7 def experiment(request, id_exp): | |||
|
495 | 494 | kwargs['experiment_keys'] = ['template', 'radar', 'name', 'start_time', 'end_time'] |
|
496 | 495 | kwargs['experiment'] = experiment |
|
497 | 496 | |
|
498 |
kwargs['configuration_keys'] = ['name', ' |
|
|
497 | kwargs['configuration_keys'] = ['name', 'device__ip_address', 'device__port_address', 'device__status'] | |
|
499 | 498 | kwargs['configurations'] = configurations |
|
500 | 499 | |
|
501 | 500 | kwargs['title'] = 'Experiment' |
@@ -839,8 +838,9 def dev_conf_new(request, id_exp=0, id_dev=0): | |||
|
839 | 838 | else: |
|
840 | 839 | if 'template' in request.GET: |
|
841 | 840 | if request.GET['template']=='0': |
|
841 | choices = [(conf.pk, '{}'.format(conf)) for conf in Configuration.objects.filter(template=True)] | |
|
842 | 842 | form = NewForm(initial={'create_from':2}, |
|
843 |
template_choices= |
|
|
843 | template_choices=choices) | |
|
844 | 844 | else: |
|
845 | 845 | kwargs['button'] = 'Create' |
|
846 | 846 | conf = Configuration.objects.get(pk=request.GET['template']) |
@@ -78,9 +78,9 class RCConfiguration(Configuration): | |||
|
78 | 78 | def __unicode__(self): |
|
79 | 79 | |
|
80 | 80 | if self.mix: |
|
81 |
return u'[MIXED]: |
|
|
81 | return u'[RC MIXED]: {}'.format(self.name) | |
|
82 | 82 | else: |
|
83 |
return u'[ |
|
|
83 | return u'[RC]: {}'.format(self.name) | |
|
84 | 84 | |
|
85 | 85 | def get_absolute_url_plot(self): |
|
86 | 86 | return reverse('url_plot_rc_pulses', args=[str(self.id)]) |
@@ -328,14 +328,13 def import_file(request, conf_id): | |||
|
328 | 328 | if request.method=='POST': |
|
329 | 329 | form = RCImportForm(request.POST, request.FILES) |
|
330 | 330 | if form.is_valid(): |
|
331 |
|
|
|
332 | #try: | |
|
331 | try: | |
|
333 | 332 | conf.update_from_file(request.FILES['file_name']) |
|
334 | 333 | messages.success(request, 'Configuration "%s" loaded succesfully' % request.FILES['file_name']) |
|
335 | 334 | return redirect(conf.get_absolute_url_edit()) |
|
336 | 335 | |
|
337 |
|
|
|
338 |
|
|
|
336 | except Exception as e: | |
|
337 | messages.error(request, 'Error parsing file: "%s" - %s' % (request.FILES['file_name'], e)) | |
|
339 | 338 | |
|
340 | 339 | else: |
|
341 | 340 | messages.warning(request, 'Your current configuration will be replaced') |
General Comments 0
You need to be logged in to leave comments.
Login now