Commit dd3121ae82fd736e1d32719210128928ab609cdd
1 parent
ad85da7c
Exists in
master
and in
1 other branch
Minor debugs on routine manager
Showing
12 changed files
with
12 additions
and
3 deletions
Show diff stats
src/pyros/settings.py
src/pyrosapp/models.py
... | ... | @@ -158,7 +158,7 @@ class Filter(models.Model): |
158 | 158 | |
159 | 159 | class FilterWheel(models.Model): |
160 | 160 | device = models.OneToOneField(Device, on_delete=models.CASCADE) |
161 | - detector = models.OneToOneField(Detector, on_delete=models.CASCADE, blank=True, null=True) | |
161 | + detector = models.OneToOneField(Detector, on_delete=models.CASCADE, related_name="filter_wheel", blank=True, null=True) | |
162 | 162 | |
163 | 163 | class Meta: |
164 | 164 | managed = True | ... | ... |
src/routine_manager/forms.py
... | ... | @@ -97,13 +97,16 @@ class PlanForm(forms.ModelForm): |
97 | 97 | |
98 | 98 | def __init__(self, *args, readonly=False, **kwargs): |
99 | 99 | super(PlanForm, self).__init__(*args, **kwargs) |
100 | + plan = kwargs["instance"] | |
101 | + | |
102 | + self.fields["filter"].queryset = plan.album.detector.filter_wheel.filters | |
103 | + | |
100 | 104 | for field in self.fields.values(): |
101 | 105 | if readonly == True: |
102 | 106 | field.widget.attrs['readonly'] = True |
103 | 107 | field.widget.attrs['class'] = 'form-control' |
104 | 108 | field.required = True |
105 | 109 | |
106 | - plan = kwargs["instance"] | |
107 | 110 | if plan.duration: |
108 | 111 | self.fields["duration"].initial = plan.duration * 86400 |
109 | 112 | ... | ... |
src/routine_manager/views.py
... | ... | @@ -405,6 +405,12 @@ def unsubmit_request(request, req_id): |
405 | 405 | """ |
406 | 406 | |
407 | 407 | req = Request.objects.get(id=req_id) |
408 | + | |
409 | +# TODO: Décommenter pour la production | |
410 | +# if req.sequences.filter(Q(status=Sequence.EXECUTED) | Q(status=Sequence.EXECUTING)).exists(): | |
411 | +# message = "You can't unsubmit an request with executed sequences" | |
412 | +# return redirect(action_request, req_id=req_id, action="view", status=-1, message=message) | |
413 | + | |
408 | 414 | req.submitted = False |
409 | 415 | req.save() |
410 | 416 | sequences = req.sequences.filter(Q(status=Sequence.TOBEPLANNED) | Q(status=Sequence.OBSERVABLE) | | ... | ... |