added topic view on the left

This commit is contained in:
CDaut 2022-06-25 16:37:22 +02:00 committed by CDaut
parent a13b2c80f5
commit 5bd92689e1
7 changed files with 150 additions and 14 deletions

View file

@ -31,12 +31,16 @@ def viewblog(request, title) -> HttpResponse:
'{% autoescape off %}' +
html_form_md +
'{% endautoescape %}').render(Context({}))
context = {'post': post, 'html': rendered_html}
context = {'post': post, 'html': rendered_html, 'roottopics': Topic.objects.all().filter(rootTopic=None),
'allposts': Blogpost.objects.all()}
return render(request, 'blog/viewpost.html', context)
def index(request) -> HttpResponse:
return render(request, 'blog/index.html', {"debug": settings.DEBUG})
context = {'roottopics': Topic.objects.all().filter(rootTopic=None), 'allposts': Blogpost.objects.all(),
'debug': settings.DEBUG}
return render(request, 'blog/index.html', context)
@login_required
@ -62,7 +66,9 @@ def order(request) -> HttpResponse:
@login_required
def addpost(request) -> HttpResponse:
context = {'alltopics': Topic.objects.all().order_by('name').values(), 'markdown': ''}
context = {'alltopics': Topic.objects.all().order_by('name').values(), 'markdown': '',
'roottopics': Topic.objects.all().filter(rootTopic=None),
'allposts': Blogpost.objects.all()}
if request.method == 'POST':
title = request.POST['title']
markdown = request.POST['markdown']