diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 4915d31a1..02d4bdfd5 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,13 +2,8 @@ - - - - - - + @@ -52,45 +47,11 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -111,8 +72,8 @@ - - + + @@ -131,8 +92,8 @@ - - + + @@ -180,14 +141,14 @@ @@ -459,14 +420,6 @@ - - - - - - - - @@ -485,14 +438,6 @@ - - - - - - - - @@ -501,14 +446,6 @@ - - - - - - - - @@ -538,6 +475,14 @@ + + + + + + + + @@ -548,20 +493,34 @@ - + - - - - - + + + - + - - + + + + + + + + + + + + + + + + + + diff --git a/cookbook/templates/index.html b/cookbook/templates/index.html index 70dc264e3..c04152b9a 100644 --- a/cookbook/templates/index.html +++ b/cookbook/templates/index.html @@ -5,9 +5,16 @@ {% block content %} -

Übersicht

+

+ Rezepte +

- - {% render_table recipes %} + {% if recipes %} + {% render_table recipes %} + {% else %} + + {% endif %} {% endblock %} \ No newline at end of file diff --git a/cookbook/templates/new_category.html b/cookbook/templates/new_category.html index 1972583d3..b85335724 100644 --- a/cookbook/templates/new_category.html +++ b/cookbook/templates/new_category.html @@ -1,5 +1,7 @@ {% extends "base.html" %} +{% block title %}Neue Kategorie{% endblock %} + {% block content %}

diff --git a/cookbook/views.py b/cookbook/views.py index 037d7f565..f9f8b7eeb 100644 --- a/cookbook/views.py +++ b/cookbook/views.py @@ -1,3 +1,4 @@ +from django.utils.translation import gettext as _ from django.contrib.auth.decorators import login_required from django.shortcuts import render, redirect from django_tables2 import RequestConfig @@ -6,9 +7,12 @@ from cookbook.tables import RecipeTable def index(request): - table = RecipeTable(Recipe.objects.all()) - RequestConfig(request, paginate={'per_page': 3}).configure(table) - return render(request, 'index.html', {'recipes': table}) + if request.user.is_authenticated: + table = RecipeTable(Recipe.objects.all()) + RequestConfig(request, paginate={'per_page': 3}).configure(table) + return render(request, 'index.html', {'recipes': table}) + else: + return render(request, 'index.html') @login_required @@ -39,7 +43,7 @@ def new_category(request): else: form = CategoryForm() - return render(request, 'new_recipe.html', {'form': form}) + return render(request, 'new_category.html', {'form': form}) @login_required diff --git a/db.sqlite3 b/db.sqlite3 index f380104f3..af973a2d0 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ