From feeeded07c0482c783bf80849e144937d9dd1f83 Mon Sep 17 00:00:00 2001 From: tkupek Date: Thu, 3 Mar 2016 22:22:15 +0100 Subject: [PATCH] set warning for empty settings --- db.sqlite3 | Bin 107520 -> 107520 bytes .../elearning/templates/setting_null.html | 37 ++++++++++++++++++ tkupek_elearning/elearning/views.py | 8 +++- 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 tkupek_elearning/elearning/templates/setting_null.html diff --git a/db.sqlite3 b/db.sqlite3 index 7596d4626f6fa1235f5e1797b442bc466768a65e..a9a1bac344088e61f00296aba9ed165e3edb3662 100644 GIT binary patch delta 223 zcmZoT!PansZGto-$3z)tMvjdM)3_LwH-G2i&6H4P)@NX@WiDqfWX@)eXAWleWp-pX zW!B#;Q6kLD!^+Ia$gT_~l_p!4pJY~M4w}qf;mpDu&K$H^kcEYri-nn!Q5i%iZH}p4 z@rH|;;Wq>0R7MYm-;)Jd-g0;=b29K-GHOqDoTsdnm|T)sma4~YWMF8fYhVmS3Py%j oKxAs5XJBY(Y;NGKgix-8UAdvTm4ShtiKUU5h57cWnT*+10Po>4q5uE@ delta 93 zcmV-j0HXhZ$OeGO29O&829X>?0S2*PmI?tOv-b)OX%ry?I{*WH19t;)18W0c15*P{ z13|MKbQ1%Spb(QgcgX`G16-2_ctf#~5(Bebd#LON0Rfc&0hO_livhQlX#s0G;#(Xq diff --git a/tkupek_elearning/elearning/templates/setting_null.html b/tkupek_elearning/elearning/templates/setting_null.html new file mode 100644 index 0000000..6afe8ec --- /dev/null +++ b/tkupek_elearning/elearning/templates/setting_null.html @@ -0,0 +1,37 @@ + + + + + + + {% load staticfiles %} + + + + + {{ settings.title }} + + + + + + + + + + +
+ +

Settings are not set. Please configure the service first!

+ + + +
+ + + \ No newline at end of file diff --git a/tkupek_elearning/elearning/views.py b/tkupek_elearning/elearning/views.py index be7950a..72379ac 100644 --- a/tkupek_elearning/elearning/views.py +++ b/tkupek_elearning/elearning/views.py @@ -27,7 +27,13 @@ def start(request): except ObjectDoesNotExist: user = None - settings = Setting.objects.get(active=1) + try: + settings = Setting.objects.get(active=1) + except ObjectDoesNotExist: + settings = None + + if settings is None: + return render_to_response('setting_null.html') if user is not None: