Example #1
0
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,))
Example #2
0
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
Example #3
0
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)
Example #4
0
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)
Example #5
0
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_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, ))
Example #7
0
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, ))
Example #8
0
 def testGetCommentApp(self):
     import custom_comments
     self.assertEqual(django_comments.get_comment_app(), custom_comments)
Example #9
0
 def testGetMissingCommentApp(self):
     msg = "The COMMENTS_APP ('django_comments') must be in INSTALLED_APPS"
     with self.assertRaisesMessage(ImproperlyConfigured, msg):
         django_comments.get_comment_app()
Example #10
0
 def testGetCommentApp(self):
     self.assertEqual(django_comments.get_comment_app(), django_comments)
 def testGetCommentApp(self):
     import custom_comments
     self.assertEqual(django_comments.get_comment_app(), custom_comments)
 def testGetMissingCommentApp(self):
     with six.assertRaisesRegex(self, ImproperlyConfigured, 'missing_app'):
         _ = django_comments.get_comment_app()
 def testGetCommentApp(self):
     self.assertEqual(django_comments.get_comment_app(), django_comments)
Example #14
0
 def testGetMissingCommentApp(self):
     with six.assertRaisesRegex(self, ImproperlyConfigured, 'missing_app'):
         django_comments.get_comment_app()
 def testGetMissingCommentApp(self):
     msg = "The COMMENTS_APP ('django_comments') must be in INSTALLED_APPS"
     with self.assertRaisesMessage(ImproperlyConfigured, msg):
         django_comments.get_comment_app()