set warning for empty settings

This commit is contained in:
tkupek 2016-03-03 22:22:15 +01:00
parent fceeb63f9f
commit feeeded07c
3 changed files with 44 additions and 1 deletions

Binary file not shown.

View 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>

View file

@ -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: