Ticket #9562: get_comment_app.diff

File get_comment_app.diff, 1.7 KB (added by oyvind, 16 years ago)

fix to make the comment templatetags use get_comment_app

  • django/contrib/comments/templatetags/comments.py

    diff --git a/django/contrib/comments/templatetags/comments.py b/django/contrib/comments/templatetags/comments.py
    index 563a3ff..b5b02c8 100644
    a b from django.utils.encoding import smart_unicode  
    77
    88register = template.Library()
    99
     10comment_app = comments.get_comment_app()
     11
    1012class BaseCommentNode(template.Node):
    1113    """
    1214    Base helper class (abstract) for handling the get_comment_* template tags.
    class BaseCommentNode(template.Node):  
    5961    def __init__(self, ctype=None, object_pk_expr=None, object_expr=None, as_varname=None, comment=None):
    6062        if ctype is None and object_expr is None:
    6163            raise template.TemplateSyntaxError("Comment nodes must be given either a literal object or a ctype and object pk.")
    62         self.comment_model = comments.get_model()
     64        self.comment_model = comment_app.get_model()
    6365        self.as_varname = as_varname
    6466        self.ctype = ctype
    6567        self.object_pk_expr = object_pk_expr
    class CommentFormNode(BaseCommentNode):  
    117119    def get_form(self, context):
    118120        ctype, object_pk = self.get_target_ctype_pk(context)
    119121        if object_pk:
    120             return comments.get_form()(ctype.get_object_for_this_type(pk=object_pk))
     122            return comment_app.get_form()(ctype.get_object_for_this_type(pk=object_pk))
    121123        else:
    122124            return None
    123125
    def comment_form_target():  
    243245
    244246        <form action="{% comment_form_target %}" method="POST">
    245247    """
    246     return comments.get_form_target()
     248    return comment_app.get_form_target()
    247249
    248250register.tag(get_comment_count)
    249251register.tag(get_comment_list)
Back to Top