This commit is contained in:
2020-05-15 19:57:22 +00:00
parent 26db8429e7
commit 2ade6d765b
6 changed files with 34 additions and 16 deletions

View File

@@ -12,7 +12,14 @@ from django_filters.rest_framework import DjangoFilterBackend
# Create your views here.
def index(request):
posts=deque(Post.objects.all())
return render(request, 'posts/index.html', {"posts": posts})
f=lambda p: p.tags
t=map(f, posts)
return render(request, 'posts/index.html', {"posts": posts, "tags_list": t })
def tags(request,tag=""):
posts=deque(Post.objects.filter(tags__name=tag))
return render(request, 'posts/index.html', {"posts": posts, "tags_list":None })
def show(request,id=None):
print("id: %s" % id)