From ab3e8f2d9667249df56413daad53b63ee990f214 Mon Sep 17 00:00:00 2001 From: "watcha.h@almacom.co.th" Date: Fri, 10 Apr 2015 09:53:50 +0700 Subject: [PATCH] [sickbed] improve load page --- netforce_clinic/models/sickbed.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/netforce_clinic/models/sickbed.py b/netforce_clinic/models/sickbed.py index 64f80c6..693c414 100644 --- a/netforce_clinic/models/sickbed.py +++ b/netforce_clinic/models/sickbed.py @@ -14,7 +14,8 @@ class SickBed(Model): image=None date='' set_active_user(1) #FIXME permission denined because of department of patient - for hd_case in sorted(obj.hd_cases, key=lambda a: a.id): + if obj.hd_cases: + hd_case=sorted(obj.hd_cases, key=lambda a: a.id)[-1] patient=hd_case.patient_id patient_id=patient.id image=patient.image