diff options
author | hardythe1 | 2014-02-19 14:36:39 +0530 |
---|---|---|
committer | hardythe1 | 2014-02-19 14:36:39 +0530 |
commit | 757d5b84d89771257c94fb7ffbe952a08adc1d1c (patch) | |
tree | 5d42ac79f2565b14c724437179994af1577e55f5 /tbc | |
parent | b1277600644ff0d0a561770bd6158e17747a0a0b (diff) | |
download | Python-TBC-Interface-757d5b84d89771257c94fb7ffbe952a08adc1d1c.tar.gz Python-TBC-Interface-757d5b84d89771257c94fb7ffbe952a08adc1d1c.tar.bz2 Python-TBC-Interface-757d5b84d89771257c94fb7ffbe952a08adc1d1c.zip |
Changes to solve malfunctioning of upload content. (chapters going in same book)
Diffstat (limited to 'tbc')
-rw-r--r-- | tbc/urls.py | 2 | ||||
-rw-r--r-- | tbc/views.py | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/tbc/urls.py b/tbc/urls.py index 5311e26..c6eae0b 100644 --- a/tbc/urls.py +++ b/tbc/urls.py @@ -11,7 +11,7 @@ urlpatterns = patterns('', url(r'^profile/$', 'tbc.views.UserProfile', name='UserProfile'), url(r'^submit-book/$', 'tbc.views.SubmitBook', name='SubmitBook'), url(r'^update-book/$', 'tbc.views.UpdateBook', name='UpdateBook'), - url(r'^upload-content/$', 'tbc.views.ContentUpload', name='ContentUpload'), + url(r'^upload-content/(?P<book_id>\d+)$', 'tbc.views.ContentUpload', name='ContentUpload'), url(r'^update-content/(?P<book_id>\d+)$', 'tbc.views.UpdateContent', name='UpdateContent'), url(r'^get-zip/(?P<book_id>\d+)$', 'tbc.views.GetZip', name='GetZip'), url(r'^browse-books/$', 'tbc.views.BrowseBooks', name='BrowseBooks'), diff --git a/tbc/views.py b/tbc/views.py index a689930..0660d04 100644 --- a/tbc/views.py +++ b/tbc/views.py @@ -188,7 +188,9 @@ def SubmitBook(request): data.contributor = profile data.save() context['user'] = curr_user - return HttpResponseRedirect('/upload-content') + curr_book = Book.objects.order_by("-id")[0] + curr_book_id = curr_book.id + return HttpResponseRedirect('/upload-content/'+str(curr_book_id)) else: context.update(csrf(request)) context['form'] = form @@ -243,9 +245,9 @@ def UpdateBook(request): return render_to_response('tbc/update-book.html', context) -def ContentUpload(request): +def ContentUpload(request, book_id=None): user = request.user - curr_book = Book.objects.order_by("-id")[0] + curr_book = Book.objects.get(id=book_id) if request.method == 'POST': for i in range(1, curr_book.no_chapters+1): chapter = Chapters() |