new topics can now be created
This commit is contained in:
parent
ee7c359d5b
commit
c71b06ac9b
4 changed files with 41 additions and 1 deletions
|
|
@ -159,3 +159,14 @@ def createmocks(request, objtype, n) -> HttpResponse:
|
|||
|
||||
print('Created ' + str(n) + ' mock topics.')
|
||||
return redirect("index")
|
||||
|
||||
|
||||
@login_required
|
||||
def addtopic(request):
|
||||
context = {'roottopics': Topic.objects.all().filter(rootTopic=None), 'allposts': Blogpost.objects.all()}
|
||||
|
||||
if request.method == 'POST':
|
||||
topictitle = request.POST['title']
|
||||
Topic.objects.get_or_create(name=topictitle)
|
||||
|
||||
return render(request, 'blog/addtopic.html', context)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue