diff --git a/cookbook/views/lists.py b/cookbook/views/lists.py index c455792bf..6fcdb6124 100644 --- a/cookbook/views/lists.py +++ b/cookbook/views/lists.py @@ -20,15 +20,27 @@ def keyword(request): table = KeywordTable(Keyword.objects.all()) RequestConfig(request, paginate={'per_page': 25}).configure(table) - return render(request, 'generic/list_template.html', {'title': _("Keyword"), 'table': table, 'create_url': 'new_keyword'}) + return render( + request, + 'generic/list_template.html', + {'title': _("Keyword"), 'table': table, 'create_url': 'new_keyword'} + ) @group_required('admin') def sync_log(request): - table = ImportLogTable(SyncLog.objects.all().order_by(Lower('created_at').desc())) + table = ImportLogTable( + SyncLog.objects.all().order_by( + Lower('created_at').desc() + ) + ) RequestConfig(request, paginate={'per_page': 25}).configure(table) - return render(request, 'generic/list_template.html', {'title': _("Import Log"), 'table': table}) + return render( + request, + 'generic/list_template.html', + {'title': _("Import Log"), 'table': table} + ) @group_required('user') @@ -37,27 +49,52 @@ def recipe_import(request): RequestConfig(request, paginate={'per_page': 25}).configure(table) - return render(request, 'generic/list_template.html', {'title': _("Discovery"), 'table': table, 'import_btn': True}) + return render( + request, + 'generic/list_template.html', + {'title': _("Discovery"), 'table': table, 'import_btn': True} + ) @group_required('user') def food(request): - f = IngredientFilter(request.GET, queryset=Food.objects.all().order_by('pk')) + f = IngredientFilter( + request.GET, + queryset=Food.objects.all().order_by('pk') + ) table = IngredientTable(f.qs) RequestConfig(request, paginate={'per_page': 25}).configure(table) - return render(request, 'generic/list_template.html', {'title': _("Ingredients"), 'table': table, 'filter': f}) + return render( + request, + 'generic/list_template.html', + {'title': _("Ingredients"), 'table': table, 'filter': f} + ) @group_required('user') def shopping_list(request): - f = ShoppingListFilter(request.GET, queryset=ShoppingList.objects.filter(Q(created_by=request.user) | Q(shared=request.user)).all().order_by('finished', 'created_at')) + f = ShoppingListFilter( + request.GET, + queryset=ShoppingList.objects.filter( + Q(created_by=request.user) | + Q(shared=request.user) + ).all().order_by('finished', 'created_at')) table = ShoppingListTable(f.qs) RequestConfig(request, paginate={'per_page': 25}).configure(table) - return render(request, 'generic/list_template.html', {'title': _("Shopping Lists"), 'table': table, 'filter': f, 'create_url': 'view_shopping'}) + return render( + request, + 'generic/list_template.html', + { + 'title': _("Shopping Lists"), + 'table': table, + 'filter': f, + 'create_url': 'view_shopping' + } + ) @group_required('admin') @@ -65,12 +102,31 @@ def storage(request): table = StorageTable(Storage.objects.all()) RequestConfig(request, paginate={'per_page': 25}).configure(table) - return render(request, 'generic/list_template.html', {'title': _("Storage Backend"), 'table': table, 'create_url': 'new_storage'}) + return render( + request, + 'generic/list_template.html', + { + 'title': _("Storage Backend"), + 'table': table, + 'create_url': 'new_storage' + } + ) @group_required('admin') def invite_link(request): - table = InviteLinkTable(InviteLink.objects.filter(valid_until__gte=datetime.today(), used_by=None).all()) + table = InviteLinkTable( + InviteLink.objects.filter( + valid_until__gte=datetime.today(), used_by=None + ).all()) RequestConfig(request, paginate={'per_page': 25}).configure(table) - return render(request, 'generic/list_template.html', {'title': _("Invite Links"), 'table': table, 'create_url': 'new_invite_link'}) + return render( + request, + 'generic/list_template.html', + { + 'title': _("Invite Links"), + 'table': table, + 'create_url': 'new_invite_link' + } + )