/docs/tags.txt

http://django-comment-utils.googlecode.com/ · Plain Text · 88 lines · 56 code · 32 blank · 0 comment · 0 complexity · 5de08272018dc609ccd57794e511017a MD5 · raw file

  1. ====================================
  2. Template tags for moderated comments
  3. ====================================
  4. The built-in template tags included with ``django.contrib.comments``
  5. for retrieving lists and counts of comments for specific objects are
  6. useful, but when mixed with an application which uses comment
  7. moderation they become problematic, because these tags look at _all_
  8. comments, rather than just those comments which are marked with
  9. ``is_public=True``. This can lead to excessive template logic to
  10. exclude moderated (non-public) comments from public display, and no
  11. workaround is possible within a template for seemingly-erroneous
  12. comment counts.
  13. To solve these problems, ``comment_utils`` includes a set of tags
  14. which closely mimic the built-in comment list and comment count tags,
  15. but which do take the ``is_public`` field into account. At the moment,
  16. they do not take into account the ``is_removed`` field on ``Comment``
  17. or the ``approved`` field on ``FreeComment``, though a future version
  18. of ``comment_utils`` may add support for this.
  19. Before using any of these tags in your templates, remember to load
  20. them with ``{% load comment_utils %}``.
  21. ``get_public_comment_count``
  22. ----------------------------
  23. Nearly identical to Django's built-in ``get_comment_count`` tag;
  24. returns the number of public ``Comment`` objects attached to a given
  25. object.
  26. Syntax::
  27. {% get_public_comment_count for [app_name].[model_name] [object_id] as [varname] %}
  28. Example::
  29. {% get_public_comment_count for blog.entry entry.id as comment_count %}
  30. ``get_public_free_comment_count``
  31. ----------------------------------
  32. Nearly identical to Django's built-in ``get_free_comment_count`` tag;
  33. returns the number of public ``FreeComment`` objects attached to a given
  34. object.
  35. Syntax::
  36. {% get_public_free_comment_count for [app_name].[model_name] [object_id] as [varname] %}
  37. Example::
  38. {% get_public_free_comment_count for blog.entry entry.id as comment_count %}
  39. ``get_public_comment_list``
  40. ---------------------------
  41. Nearly identical to Django's built-in ``get_comment_list`` tag;
  42. returns a list of public ``Comment`` objects attached to a given
  43. object.
  44. Syntax::
  45. {% get_public_comment_list for [app_name].[model_name] [object_id] as [varname] %}
  46. Example::
  47. {% get_public_comment_list for blog.entry entry.id as comment_list %}
  48. ``get_public_free_comment_list``
  49. --------------------------------
  50. Nearly identical to Django's built-in ``get_free_comment_list`` tag;
  51. returns a list of public ``FreeComment`` objects attached to a given
  52. object.
  53. Syntax::
  54. {% get_public_free_comment_list for [app_name].[model_name] [object_id] as [varname] %}
  55. Example::
  56. {% get_public_free_comment_list for blog.entry entry.id as comment_list %}