Improve form and object data passing code.

This commit is contained in:
Roberto Rosario
2015-08-25 20:28:59 -04:00
parent 7a45164251
commit 72c63bfedc
3 changed files with 48 additions and 21 deletions

View File

@@ -52,6 +52,11 @@ class DocumentCommentCreateView(SingleObjectCreateView):
'document': self.get_document(), 'user': self.request.user,
}
def get_save_extra_data(self):
return {
'_user': self.request.user,
}
def get_post_action_redirect(self):
return reverse(
'comments:comments_for_document', args=(self.kwargs['pk'],)