Exemplo n.º 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,))
Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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, ))
Exemplo n.º 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, ))
Exemplo n.º 8
0
 def testGetCommentApp(self):
     import custom_comments
     self.assertEqual(django_comments.get_comment_app(), custom_comments)
Exemplo n.º 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()
Exemplo n.º 10
0
 def testGetCommentApp(self):
     self.assertEqual(django_comments.get_comment_app(), django_comments)
Exemplo n.º 11
0
 def testGetCommentApp(self):
     import custom_comments
     self.assertEqual(django_comments.get_comment_app(), custom_comments)
Exemplo n.º 12
0
 def testGetMissingCommentApp(self):
     with six.assertRaisesRegex(self, ImproperlyConfigured, 'missing_app'):
         _ = django_comments.get_comment_app()
Exemplo n.º 13
0
 def testGetCommentApp(self):
     self.assertEqual(django_comments.get_comment_app(), django_comments)
Exemplo n.º 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()