diff options
author | hardythe1 | 2015-05-08 13:20:59 +0530 |
---|---|---|
committer | hardythe1 | 2015-05-08 13:20:59 +0530 |
commit | 285a24aeb96bfcf2744a4dddd8c72a598568e652 (patch) | |
tree | 16ab6de15357a92909d7990f675938b1b12ee07a | |
parent | 055bab04664a61aaa92cb8eef39ca2321917e04e (diff) | |
download | Python-TBC-Interface-285a24aeb96bfcf2744a4dddd8c72a598568e652.tar.gz Python-TBC-Interface-285a24aeb96bfcf2744a4dddd8c72a598568e652.tar.bz2 Python-TBC-Interface-285a24aeb96bfcf2744a4dddd8c72a598568e652.zip |
Handle POST for additional chapters
-rwxr-xr-x | tbc/views.py | 9 |
1 files changed, 8 insertions, 1 deletions
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)] |