tag list
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user