diff --git a/web/templates/base.html b/web/templates/base.html index fe1eeb84fcc57faea151daf6194ff1b6feebb0f0..393205b2fa74d1652b2d64b4b57300a03eb405ad 100644 --- a/web/templates/base.html +++ b/web/templates/base.html @@ -14,7 +14,7 @@ <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>Warpzone - {{ page_title }}</title> + <title>{% block title %}{% endblock %} - Warpzone</title> <style> .table-scrollable{ diff --git a/web/warpauth/templates/warpauth/about.html b/web/warpauth/templates/warpauth/about.html deleted file mode 100644 index 1bca9990050f399c7d712be68f8e10ca7c6bea57..0000000000000000000000000000000000000000 --- a/web/warpauth/templates/warpauth/about.html +++ /dev/null @@ -1,11 +0,0 @@ -{% extends "base.html" %} - -{% load i18n %} -{% block content %} - - <h2>{{ body_text }}</h2> - <p class="lead">{% trans "Welcome to Warpzone internal" %}</p> - <p> - Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. - </p> -{% endblock %} \ No newline at end of file diff --git a/web/warpauth/templates/warpauth/login.html b/web/warpauth/templates/warpauth/login.html index 55ec5c17108cbb7101684eb0bc44e84b327ea2e8..0e5f383eec06e6608740b8aff8c96b187eb05897 100644 --- a/web/warpauth/templates/warpauth/login.html +++ b/web/warpauth/templates/warpauth/login.html @@ -1,6 +1,6 @@ {% extends "base.html" %} {% load i18n %} - +{% block title %}{% trans "Login" %}{% endblock %} {% block content %} <form class="form-signin" style="max-width: 330px; margin: 0 auto; padding: 40px"> diff --git a/web/warpauth/templates/warpauth/profile.html b/web/warpauth/templates/warpauth/profile.html index b6b39885cb59c454e722814db82f70c29eec9dd2..5445ae78f93b7b7010746da21d2c4bd3c8029618 100644 --- a/web/warpauth/templates/warpauth/profile.html +++ b/web/warpauth/templates/warpauth/profile.html @@ -4,7 +4,7 @@ {% block content %} -<p class="lead">{% trans "Profile Settings" %}</p><p></p> +<p class="lead">{% block title %}{% trans "Profile Settings" %}{% endblock %}</p><p></p> <div> diff --git a/web/warpauth/templates/warpauth/register.html b/web/warpauth/templates/warpauth/register.html index 7a75ec939eabaece39407ca5f879605ef2f11481..8d6e6d5af579aa6fcab3350e250b351e271599ce 100644 --- a/web/warpauth/templates/warpauth/register.html +++ b/web/warpauth/templates/warpauth/register.html @@ -1,6 +1,6 @@ {% extends "base.html" %} {% load i18n %} - +{% block title %}{% trans "Registration" %}{% endblock %} {% block content %} {% if success %} <div class="alert alert-success"> @@ -26,6 +26,8 @@ {% trans "The Email adress is invalid." %} {% elif error == "fill_all_fields" %} {% trans "Please fill all fields." %} + {% elif error == "invalid_username" %} + {% trans "Username can only contain alphanumeric characters and the underscore." %} {% endif %} </strong> </div> diff --git a/web/warpauth/templates/warpauth/reset_password/change_password.html b/web/warpauth/templates/warpauth/reset_password/change_password.html index 0ae3d12dc1da628a52079237541e01902df79513..bd1fdd86d7de2ced74497947766ca9a7e085d88d 100644 --- a/web/warpauth/templates/warpauth/reset_password/change_password.html +++ b/web/warpauth/templates/warpauth/reset_password/change_password.html @@ -1,6 +1,6 @@ {% extends "base.html" %} {% load i18n %} - +{% block title %}{% trans "Reset Password" %}{% endblock %} {% block content %} {% if token_error %} <h2 class="form-signin-heading">{% trans "The Token is invalid" %}</h2> diff --git a/web/warpauth/templates/warpauth/reset_password/token_gen.html b/web/warpauth/templates/warpauth/reset_password/token_gen.html index 98033d13993f78fd26c0aaedb5ebc86c2b8fc940..b38577f3aa619badde49ae422c8b1c0c010a5856 100644 --- a/web/warpauth/templates/warpauth/reset_password/token_gen.html +++ b/web/warpauth/templates/warpauth/reset_password/token_gen.html @@ -1,6 +1,6 @@ {% extends "base.html" %} {% load i18n %} - +{% block title %}{% trans "Reset Password" %}{% endblock %} {% block content %} {% if request.POST %} <h2 class="form-signin-heading">{% trans "If your information were right, you've got an Email" %}</h2> diff --git a/web/warpauth/views/register.py b/web/warpauth/views/register.py index c5d8431e6a0e6ddbe178576cd5660dc123d00d29..a935e6d741d3e72fd6f7299dd2037f1b21524424 100644 --- a/web/warpauth/views/register.py +++ b/web/warpauth/views/register.py @@ -1,3 +1,4 @@ +import re from django.core.exceptions import ValidationError from django import forms from django.shortcuts import render @@ -11,7 +12,6 @@ def register(request): pages['error'] = False if request.method == "POST": - print(request.POST) username = request.POST['username'] password = request.POST['password'] password2 = request.POST['password2'] @@ -24,6 +24,8 @@ def register(request): if username == "" or email == "" or password == "" or password2 == "": pages['error'] = "fill_all_fields" + elif not re.search(r'^\w+$', username): + pages['error'] = "invalid_username" elif password != password2: pages['error'] = "passwords_did_not_match" elif not pages["error"]: diff --git a/web/warpfood/templates/warpfood/main.html b/web/warpfood/templates/warpfood/main.html index 8df769b07e39291399547680b56bfa29ab629d3a..295889e40cb7e4db051185b63d3963ce9b796238 100644 --- a/web/warpfood/templates/warpfood/main.html +++ b/web/warpfood/templates/warpfood/main.html @@ -3,7 +3,7 @@ {% load i18n %} {% load humanize %} {% load bootstrap %} - +{% block title %}{% trans "Pizza Sheet" %}{% endblock %} {% block content %} {% if user.is_authenticated %} <div class="panel panel-default"> @@ -22,11 +22,20 @@ {% endif %} <table class="table table-striped table-hover"> <thead> - <tr><th>{% trans "Estimated Order Time" %}</th><th>{% trans "Pizza Service" %}</th></tr> + <tr><th>{% trans "Estimated Order Time" %}</th><th>{% trans "Pizza Service" %}</th><th>{% trans "Status" %}</th></tr> </thead> <tbody> {% for sheet in food_sheets %} - <tr data-link="/pizza/view/{{ sheet.id }}/"><td>{{ sheet.estimated_order_time | naturaltime }}</td><td>{{ sheet.food_service }}</td></tr> + <tr data-link="/pizza/view/{{ sheet.id }}/"> + <td>{{ sheet.estimated_order_time | naturaltime }}</td> + <td>{{ sheet.food_service }}</td> + <td> + {% if sheet.closed %} + <span class="btn btn-xs btn-danger">Closed</span> + {% else %} + <span class="btn btn-xs btn-success">Open</span> + {% endif %} + </td> {% endfor %} </tbody> </table> diff --git a/web/warpfood/templates/warpfood/view.html b/web/warpfood/templates/warpfood/view.html index e5d33a1947cfc2a5085fccd9d8901532c360aedf..c87766fcfd67d964621c54295046a0b10fc7ff36 100644 --- a/web/warpfood/templates/warpfood/view.html +++ b/web/warpfood/templates/warpfood/view.html @@ -3,6 +3,7 @@ {% load i18n %} {% load bootstrap %} {% load humanize %} +{% block title %}{% trans "Pizza Sheet" %}{% endblock %} {% block content %} <div class="panel panel-default"> diff --git a/web/warpfood/views.py b/web/warpfood/views.py index fc8423445c80fdeab3a6844bc46c256b5cd1f2b5..c9e77d42a180013d7d75681b29b7c7eb6d7d7e39 100644 --- a/web/warpfood/views.py +++ b/web/warpfood/views.py @@ -24,7 +24,7 @@ def index(request): form.save() else: pages['error'] = form.errors - pages['food_sheets'] = FoodSheet.objects.all() + pages['food_sheets'] = FoodSheet.objects.order_by("-id") pages['pizza_services'] = FoodService.objects.all() pages['create_food_sheet'] = FoodSheetForm() return HttpResponse(render(request, 'warpfood/main.html', pages)) diff --git a/web/warpmain/templates/warpmain/about.html b/web/warpmain/templates/warpmain/about.html index 5c5d2749d7b1e6f73deb986ac23372b9b56c8a8c..7b106a3e81e7aeef4406022b810556df1723578d 100644 --- a/web/warpmain/templates/warpmain/about.html +++ b/web/warpmain/templates/warpmain/about.html @@ -2,7 +2,7 @@ {% load i18n %} {% block content %} - <h2>{% trans "About" %}</h2> + <h2>{% block title %}{% trans "About" %}{% endblock %}</h2> <p class="lead">Welcome to Warpzone Internal</p> <p class="text-justify"> diff --git a/web/warpmain/templates/warpmain/main.html b/web/warpmain/templates/warpmain/main.html index ac5d1cd430be26ee01fa20a42dfdef5f5d389872..5a036cd9c010886bb6a080a585e2a5721f8978c3 100644 --- a/web/warpmain/templates/warpmain/main.html +++ b/web/warpmain/templates/warpmain/main.html @@ -3,7 +3,7 @@ {% load i18n %} {% block content %} - <h2>{% trans "News" %}</h2> + <h2>{% block title %}{% trans "News" %}{% endblock %}</h2> {% for news in news_list %} <div class="panel panel-primary">