summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikaël Ates <mates@entrouvert.com>2016-01-18 17:06:55 (GMT)
committerMikaël Ates <mates@entrouvert.com>2016-01-18 17:06:55 (GMT)
commit2f5db7a6c1c7bd8d4fe93c4a181adbd56b89cdb9 (patch)
tree26bd7c8ef04c2d4c71947a66d840972d472aac9b
parent8889e647361e4b1341ea5536f0c05ccb9348ffe9 (diff)
downloadbiomon-2f5db7a6c1c7bd8d4fe93c4a181adbd56b89cdb9.zip
biomon-2f5db7a6c1c7bd8d4fe93c4a181adbd56b89cdb9.tar.gz
biomon-2f5db7a6c1c7bd8d4fe93c4a181adbd56b89cdb9.tar.bz2
Add manual checking forms to PatientDetail view.
-rw-r--r--src/biomon/views.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/biomon/views.py b/src/biomon/views.py
index c3451c6..63a0b29 100644
--- a/src/biomon/views.py
+++ b/src/biomon/views.py
@@ -116,6 +116,8 @@ class PatientDetail(cbv.MultiUpdateView):
forms_classes = {
'main': forms.MainForm,
'simple_alert_profile' : forms.SimpleAlertProfileForm,
+ 't_check' : forms.TemperatureCheckForm,
+ 'hr_check' : forms.HeartrateCheckForm,
}
template_name = "biomon/patient_detail.html"
success_url = '.'
@@ -127,7 +129,16 @@ class PatientDetail(cbv.MultiUpdateView):
return result
def form_valid(self, form):
- messages.add_message(self.request, messages.INFO, _(u'Patient record updated.'))
+ if 't_check' in form and form.get('t_check').is_valid():
+ form.get('t_check').cleaned_data['patient'] = self.get_object()
+ tc = models.TemperatureCheck(**form.get('t_check').cleaned_data)
+ tc.save()
+ if 'hr_check' in form and form.get('hr_check').is_valid():
+ form.get('hr_check').cleaned_data['patient'] = self.get_object()
+ hrc = models.HeartrateCheck(**form.get('hr_check').cleaned_data)
+ hrc.save()
+ messages.add_message(self.request, messages.INFO,
+ _(u'Patient record updated.'))
return super(PatientDetail, self).form_valid(form)
def get_context_data(self, **kwargs):