equal
deleted
inserted
replaced
306 chapter = shortcuts.get_object_or_404(taskapp_models.Task, pk=chapter_id) |
306 chapter = shortcuts.get_object_or_404(taskapp_models.Task, pk=chapter_id) |
307 |
307 |
308 if chapter.parent.id != int(book_id): |
308 if chapter.parent.id != int(book_id): |
309 raise exceptions.PyTaskException(NOT_A_PARENT_FOR_CHAPTER) |
309 raise exceptions.PyTaskException(NOT_A_PARENT_FOR_CHAPTER) |
310 |
310 |
311 return task_view.edit_task(request, chapter_id) |
311 kwargs = { |
|
312 'task_url': reverse( |
|
313 'view_chapter', kwargs={'book_id': book_id, 'chapter_id': chapter_id}) |
|
314 } |
|
315 |
|
316 return task_view.edit_task(request, chapter_id, **kwargs) |
312 |
317 |
313 |
318 |
314 def view_chapter(request, book_id, chapter_id, |
319 def view_chapter(request, book_id, chapter_id, |
315 template='task/chapter_edit.html'): |
320 template='task/chapter_edit.html'): |
316 """View that displays the chapter of the textbook. |
321 """View that displays the chapter of the textbook. |
327 |
332 |
328 context = { |
333 context = { |
329 'edit_url': reverse('edit_chapter', kwargs={ |
334 'edit_url': reverse('edit_chapter', kwargs={ |
330 'book_id': book_id, 'chapter_id': chapter_id}) |
335 'book_id': book_id, 'chapter_id': chapter_id}) |
331 } |
336 } |
332 kwargs = {'context': context} |
337 kwargs = { |
|
338 'context': context, |
|
339 'task_url': reverse( |
|
340 'view_chapter', kwargs={'book_id': book_id, 'chapter_id': chapter_id}) |
|
341 } |
333 |
342 |
334 return task_view.view_task(request, chapter_id, **kwargs) |
343 return task_view.view_task(request, chapter_id, **kwargs) |
335 |
344 |
336 @login_required |
345 @login_required |
337 def approve_textbook(request, task_id): |
346 def approve_textbook(request, task_id): |