Ticket #9303: 9303_hasattr.diff

File 9303_hasattr.diff, 819 bytes (added by Thejaswi Puthraya, 16 years ago)

First method that uses hasattr

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

    diff --git a/django/contrib/comments/templatetags/comments.py b/django/contrib/comments/templatetags/comments.py
    index 563a3ff..d275de5 100644
    a b class BaseCommentNode(template.Node):  
    8080            content_type = ctype,
    8181            object_pk    = smart_unicode(object_pk),
    8282            site__pk     = settings.SITE_ID,
    83             is_public    = True,
    8483        )
    85         if getattr(settings, 'COMMENTS_HIDE_REMOVED', True):
     84        if hasattr(self.comment_model,'is_public'):
     85            qs.filter(is_public=True)
     86        if getattr(settings, 'COMMENTS_HIDE_REMOVED', True) and hasattr(self.comment_model, 'is_removed'):
    8687            qs = qs.filter(is_removed=False)
    8788
    8889        return qs
Back to Top