Example #1
0
def get_edit_form():
    """
    Returns a (new) comment edit form object
    """
    if get_comment_app_name() != DEFAULT_COMMENTS_APP and hasattr(get_comment_app(), "get_edit_form"):
        return get_comment_app().get_edit_form()
    else:
        return CommentEditForm
Example #2
0
def get_edit_form_target(comment):
    """
    Returns the target URL for the comment edit form submission view.
    """
    if get_comment_app_name() != DEFAULT_COMMENTS_APP and hasattr(get_comment_app(), "get_edit_form_target"):
        return get_comment_app().get_edit_form_target()
    else:
        return urlresolvers.reverse("comments_extension.views.moderation.edit", args=(comment.id,))
Example #3
0
def get_edit_modelform(comment):
    """
    Returns the comment ModelForm instance
    """
    if get_comment_app_name() != DEFAULT_COMMENTS_APP and hasattr(get_comment_app(), "get_edit_modelform"):
        return get_comment_app().get_edit_modelform()
    else:
        return CommentEditForm(instance=comment)
Example #4
0
 def testGetCommentApp(self):
     from comment_tests import custom_comments
     self.assertEqual(comments.get_comment_app(), custom_comments)
Example #5
0
 def testGetCommentApp(self):
     self.assertEqual(comments.get_comment_app(), comments)
Example #6
0
 def testGetMissingCommentApp(self):
     with six.assertRaisesRegex(self, ImproperlyConfigured, 'missing_app'):
         comments.get_comment_app()