display number of subscribers to post
authorAlexander Solovyov <piranha@piranha.org.ua>
Mon Dec 01 16:43:26 2008 +0200 (2 months ago)
changeset 122506d85be4801d
parent 1223a3f5e597ffb6
child 12262c3cc74d9c79
display number of subscribers to post
apps/blog/managers.py
templates/blog/post_detail.html
themes/mirev/blog/post_detail.html
       1 --- a/apps/blog/managers.py	Mon Dec 01 15:05:25 2008 +0200
       2 +++ b/apps/blog/managers.py	Mon Dec 01 16:43:26 2008 +0200
       3 @@ -12,11 +12,20 @@
       4          'AND comment_nodes.approved'}
       5  if appcheck.pingback:
       6      SELECT_SQL.update({
       7 -    'pingback_count': 'SELECT COUNT(*) FROM pingback, django_content_type ' \
       8 -        'WHERE pingback.content_type_id = django_content_type.id ' \
       9 -        'AND django_content_type.model = \'post\' ' \
      10 -        'AND pingback.object_id = blog_post.id'
      11 -    })
      12 +            'pingback_count': (
      13 +                'SELECT COUNT(*) FROM pingback, django_content_type '
      14 +                'WHERE pingback.content_type_id = django_content_type.id '
      15 +                'AND django_content_type.model = \'post\' '
      16 +                'AND pingback.object_id = blog_post.id'
      17 +                )})
      18 +if appcheck.watchlist:
      19 +    SELECT_SQL.update({
      20 +            'watchlist_count': (
      21 +                'SELECT COUNT(*) FROM watchlist_subscription, django_content_type '
      22 +                'WHERE watchlist_subscription.content_type_id = django_content_type.id '
      23 +                'AND django_content_type.model = \'post\' '
      24 +                'AND watchlist_subscription.object_id = blog_post.id'
      25 +                )})
      26  
      27  
      28  class PostManager(models.Manager):
     1.1 --- a/templates/blog/post_detail.html	Mon Dec 01 15:05:25 2008 +0200
     1.2 +++ b/templates/blog/post_detail.html	Mon Dec 01 16:43:26 2008 +0200
     1.3 @@ -31,6 +31,7 @@
     1.4      {% else %}
     1.5      <a class="subscribe-link" href="{% unsubscribe_url object %}">{% trans "Unsubscribe" %}</a>
     1.6      {% endif %}
     1.7 +    ({% trans "already" %}: {{ object.watchlist_count }})
     1.8    {% endifapp %}
     1.9    <a class="comment-link" onclick="return comment();" href="#">{% trans "Comment post" %}</a>
    1.10  </span>
     2.1 --- a/themes/mirev/blog/post_detail.html	Mon Dec 01 15:05:25 2008 +0200
     2.2 +++ b/themes/mirev/blog/post_detail.html	Mon Dec 01 16:43:26 2008 +0200
     2.3 @@ -43,6 +43,7 @@
     2.4          {% else %}
     2.5          <a class="subscribe-link" href="{% unsubscribe_url object %}">{% trans "Unsubscribe" %}</a>
     2.6          {% endif %}
     2.7 +        ({% trans "already" %}: {{ object.watchlist_count }})
     2.8        {% endifapp %}
     2.9        <a class="comment-link" onclick="return comment('div#comments h2:first', 1);" href="#">{% trans "Comment post" %}</a>
    2.10    </span></h2>