def get_edit_form_target(comment): """ Returns the target URL for the comment edit form submission view. """ if django_comments.get_comment_app_name() != django_comments.DEFAULT_COMMENTS_APP and \ hasattr(django_comments.get_comment_app(), "get_edit_form_target"): return django_comments.get_comment_app().get_edit_form_target() else: return urlresolvers.reverse("vault.apps.comments_extension.views.moderation.edit", args=(comment.id,))
def get_edit_form(): """ Returns a (new) comment edit form object """ if django_comments.get_comment_app_name() != django_comments.DEFAULT_COMMENTS_APP and \ hasattr(django_comments.get_comment_app(), "get_edit_form"): return django_comments.get_comment_app().get_edit_form() else: return CommentEditForm
def get_edit_modelform(comment): """ Returns the comment ModelForm instance """ if django_comments.get_comment_app_name() != django_comments.DEFAULT_COMMENTS_APP and \ hasattr(django_comments.get_comment_app(), "get_edit_modelform"): return django_comments.get_comment_app().get_edit_modelform() else: return CommentEditForm(instance=comment)
def get_edit_form_target(comment): """ Returns the target URL for the comment edit form submission view. """ from comments_extension.forms import CommentEditForm if django_comments.get_comment_app_name() != django_comments.DEFAULT_COMMENTS_APP and \ hasattr(django_comments.get_comment_app(), "get_edit_form_target"): return django_comments.get_comment_app().get_edit_form_target() else: return reverse("comments_extension:comments-edit", args=(comment.id, ))
def get_edit_form_target(comment): """ Returns the target URL for the comment edit form submission view. """ if django_comments.get_comment_app_name() != django_comments.DEFAULT_COMMENTS_APP and \ hasattr(django_comments.get_comment_app(), "get_edit_form_target"): return django_comments.get_comment_app().get_edit_form_target() else: return urlresolvers.reverse("comments_extension.views.moderation.edit", args=(comment.id, ))
def testGetCommentApp(self): import custom_comments self.assertEqual(django_comments.get_comment_app(), custom_comments)
def testGetMissingCommentApp(self): msg = "The COMMENTS_APP ('django_comments') must be in INSTALLED_APPS" with self.assertRaisesMessage(ImproperlyConfigured, msg): django_comments.get_comment_app()
def testGetCommentApp(self): self.assertEqual(django_comments.get_comment_app(), django_comments)
def testGetMissingCommentApp(self): with six.assertRaisesRegex(self, ImproperlyConfigured, 'missing_app'): _ = django_comments.get_comment_app()
def testGetMissingCommentApp(self): with six.assertRaisesRegex(self, ImproperlyConfigured, 'missing_app'): django_comments.get_comment_app()