From a183b53ae7a3a3fa8f260ab02347fd689114b30c Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Thu, 1 Feb 2018 00:28:15 +0100 Subject: [PATCH] cleanup --- .idea/workspace.xml | 125 +++++++++------------------ cookbook/templates/index.html | 13 ++- cookbook/templates/new_category.html | 2 + cookbook/views.py | 12 ++- db.sqlite3 | Bin 172032 -> 172032 bytes 5 files changed, 62 insertions(+), 90 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 4915d31a..02d4bdfd 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 70dc264e..c04152b9 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 1972583d..b8533572 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 037d7f56..f9f8b7ee 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 f380104f38b7461ea871aeabad5fa2128447016c..af973a2d0eee6f9795b92178d35b0c643fac66f0 100644 GIT binary patch delta 159 zcmZoTz}0YoYl1Xm?L--8#@dYuq4Rl-t&B{q3=Q-Q%*+hUn-9(3erP@;$9{#(f`X#T z41*%`)SN6c%M^pWg2KYw3`?_$w35uis@(kTui}_E7!kTHO^l4T|Bq*S$WKt~wgRS4 L{OCICnHUuSK~FY4 delta 159 zcmZoTz}0YoYl1Xm$Neq4RkStxSN(T+h(N$k?*^(ERO(<}-5aSEwj2DoQUh zHO|gYH_Ep(&MeBX$TQDKE-kUlv9!#|Pucz|j){X2q1)8L#9;gXc&3N^1hsA}VEV+5 KuCtzrQ2_w(B{c2;