From 285a24aeb96bfcf2744a4dddd8c72a598568e652 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Fri, 8 May 2015 13:20:59 +0530 Subject: Handle POST for additional chapters --- tbc/views.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tbc') diff --git a/tbc/views.py b/tbc/views.py index ba97835..404d644 100755 --- a/tbc/views.py +++ b/tbc/views.py @@ -855,7 +855,14 @@ def SubmitCode(request): chapter.save() counter += 1 num_new_chapters = curr_book.no_chapters - old_chapter_count - return HttpResponse(num_new_chapters) + if num_new_chapters > 0: + for i in range(num_new_chapters): + new_chapter = Chapters() + new_chapter.book = curr_book + new_chapter.name = request.POST['chapter'+str(counter)] + new_chapter.notebook = request.FILES['notebook'+str(counter)] + new_chapter.save() + counter += 1 counter = 1 for screenshot in screen_shots: screenshot.caption = request.POST['caption'+str(counter)] -- cgit