set warning for empty settings
This commit is contained in:
parent
fceeb63f9f
commit
feeeded07c
3 changed files with 44 additions and 1 deletions
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
37
tkupek_elearning/elearning/templates/setting_null.html
Normal file
37
tkupek_elearning/elearning/templates/setting_null.html
Normal file
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
{% load staticfiles %}
|
||||
<link rel="stylesheet" href="{% static 'css/style.css' %}">
|
||||
<link href="{% static 'images/favicon.ico' %}" rel="shortcut icon">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<title>{{ settings.title }}</title>
|
||||
|
||||
<!-- Latest compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
|
||||
|
||||
<!-- Optional theme -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="container" style="margin-top:10%">
|
||||
|
||||
<p>Settings are not set. Please configure the service first!</p>
|
||||
<a id='adminurl' href=""></a>
|
||||
<script language='javascript' type="text/javascript">
|
||||
url = location.protocol + '//' + location.host + '/admin';
|
||||
link = document.getElementById("adminurl");
|
||||
link.href=url;
|
||||
link.innerHTML=url;
|
||||
</script>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -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:
|
||||
|
||||
|
|
Loading…
Reference in a new issue