From 9b0708fdff9d1ea88326477613ab3ca85f989549 Mon Sep 17 00:00:00 2001 From: tkupek Date: Sat, 5 Mar 2016 13:20:23 +0100 Subject: [PATCH] fixed bug with no settings in statistic page --- db.sqlite3 | Bin 137216 -> 137216 bytes tkupek_elearning/elearning/views.py | 8 ++++++++ 2 files changed, 8 insertions(+) diff --git a/db.sqlite3 b/db.sqlite3 index 14df51fac4272fa000f4acb40f89dbcbe0fb502c..7c942b4797d9a837edf1e0a6062b714f08b4a8b8 100644 GIT binary patch delta 234 zcmZqJz|pXQV}dke(?l6(#-@!4)3_L|H-G2i&6Kldn$N&o%UsS}$ehg_&m7F`%k0Q( z%B;_<$*jyYf3reKEfX6nGb1Cr_2#8z@r=yYOou14SCnq9D$!<|tiU1zmSnQte6lJ+ zfydC)%E(mD!ob4V*nD!`ZjH&Iv-3rabq!1v42`S|&8!TJ^vq3-OifKU-b=$Tp= dS(ur5T1^iWVYJ?!<<3~c#K^JzxhJFKIRKLwK2ZPw delta 182 zcmV;n07?IVun2#^~Ae~}zR0e`VzmI?tnv-b)OX&gENr2qqc19t;)18W0c15*P{ z13?2d11|$910$0N$SJc+bW{S7PzbZ7c3%MlIs(a)2Y7X}5d=*Fv&ni`APg`tIy5yd zI5{{qGcl8XyC{=Yn{N~{Eiy46GB7$ZH##ykE;lzdIWRP{*qbH{0SUAJrv;n}0|PAp k1H1!x11+-=1RnzeNjjHN6ahQ8YDWQl0s#rP=Scw>&Y}i0S^xk5 diff --git a/tkupek_elearning/elearning/views.py b/tkupek_elearning/elearning/views.py index 72379ac..a9757f4 100644 --- a/tkupek_elearning/elearning/views.py +++ b/tkupek_elearning/elearning/views.py @@ -135,6 +135,14 @@ def statistic(request): token = request.GET.get('token') + try: + settings = Setting.objects.get(active=1) + except ObjectDoesNotExist: + settings = None + + if settings is None: + return render_to_response('setting_null.html') + try: auth = Setting.objects.get(active=1, token=token) except ObjectDoesNotExist: