mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
list views
This commit is contained in:
23
cookbook/views/lists.py
Normal file
23
cookbook/views/lists.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.shortcuts import render
|
||||
from django_tables2 import RequestConfig
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
from cookbook.models import Category, Keyword
|
||||
from cookbook.tables import CategoryTable, KeywordTable
|
||||
|
||||
|
||||
@login_required
|
||||
def category_list(request):
|
||||
table = CategoryTable(Category.objects.all())
|
||||
RequestConfig(request, paginate={'per_page': 25}).configure(table)
|
||||
|
||||
return render(request, 'generic/list_template.html', {'title': _("Category"), 'table': table})
|
||||
|
||||
|
||||
@login_required
|
||||
def keyword_list(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})
|
||||
Reference in New Issue
Block a user