]> git.parisson.com Git - django-postman.git/commitdiff
Remove the dependency to django-pagination in the default template set
authorPatrick Samson <pk.samson@gmail.com>
Sun, 25 Nov 2012 20:56:55 +0000 (21:56 +0100)
committerPatrick Samson <pk.samson@gmail.com>
Sun, 25 Nov 2012 20:56:55 +0000 (21:56 +0100)
docs/faq.rst
docs/tags-filters.rst
postman/templates/postman/base_folder.html
postman/templatetags/pagination_tags.py [new file with mode: 0644]
postman/templatetags/pagination_tags_for_tests.py [deleted file]
postman/tests.py

index bab1fe075b796437240104ee5c0226365f8087d6..4afcde050b63f8f50f98adb544e3df396c3ab16b 100644 (file)
@@ -6,6 +6,11 @@ General
 \r
 **I don't want to bother with the moderation feature, how to bypass it?**\r
     Set the configuration option::\r
-    \r
+\r
         POSTMAN_AUTO_MODERATE_AS = True\r
-    
\ No newline at end of file
+\r
+**I installed django-pagination, and still I don't see any pagination widgets**\r
+\r
+* Is there really more messages than one page capacity (default is 20)?\r
+* Check that ``pagination`` is declared before ``postman`` in the ``INSTALLED_APPS`` setting.\r
+* See if it's better by disabling :file:`postman/templatetags/pagination_tags.py` and :file:`.pyc` (rename or move the files).\r
index d4a8a3f0bdb9d87660cae5f8db5213360d0eacb6..664b70bd27e4c58e509145fc07f67b56d703eb6a 100644 (file)
@@ -11,9 +11,12 @@ that are not intended for your site design:
 * :file:`postman_admin_modify.py`: a library exclusively designed for a customized change_form\r
   template used in the Admin site for the moderation of pending messages.\r
 \r
-* :file:`pagination_tags_for_tests.py`: a mock of the django-pagination application template tags,\r
-  only usable for the test suite in case the real application is not installed.\r
-  To rename to :file:`pagination_tags.py` during the test session.\r
+* :file:`pagination_tags.py`: a mock of the django-pagination application template tags.\r
+  For convenience, the design of the default template set is done with the use of that application.\r
+  The mock will avoid failures in template rendering if the real application is not installed,\r
+  as it may be the case for the test suite run in a minimal configuration.\r
+  To deactivate the mock and use the real implementation, just make sure that ``pagination`` is declared\r
+  before ``postman`` in the ``INSTALLED_APPS`` setting.\r
 \r
 Tags\r
 ----\r
index 10a2da4a4035929f968a0146766072f246ba8e80..f0ab833755c85d552dd77443d3c307346a72e935 100644 (file)
@@ -1,6 +1,13 @@
 {% extends "postman/base.html" %}
 {% load url from future %}
-{% load i18n postman_tags %}{% load pagination_tags %}
+{% load i18n postman_tags %}{% load pagination_tags %}{% comment %}
+WARNING: 'pagination_tags' is a name from the django-pagination application.
+For convenience, the design of this template is done with the use of that application.
+Django-postman will still be working, even if that application is not installed, by providing a mock
+for the template tag library.
+If the real implementation is to be used, just make sure that 'pagination' is declared before 'postman'
+in the INSTALLED_APPS setting.
+{% endcomment %}
 {% block content %}
 <div id="postman">
 <h1>{% block pm_folder_title %}{% endblock %}</h1>
diff --git a/postman/templatetags/pagination_tags.py b/postman/templatetags/pagination_tags.py
new file mode 100644 (file)
index 0000000..4b8f957
--- /dev/null
@@ -0,0 +1,30 @@
+"""
+A mock of django-pagination's pagination_tags.py that does nothing.
+
+'pagination_tags' is a name from the django-pagination application.
+For convenience, the design of the default template set is done with the use of that application.
+This mock will avoid failures in template rendering if the real application is not installed,
+as it may be the case for the test suite run in a minimal configuration.
+
+To deactivate this mock and use the real implementation, just make sure that 'pagination' is declared
+before 'postman' in the INSTALLED_APPS setting.
+"""
+from django.template import Node, Library
+
+register = Library()
+
+class AutoPaginateNode(Node):
+    def render(self, context):
+        return u''
+
+@register.tag
+def autopaginate(parser, token):
+    return AutoPaginateNode()
+
+class PaginateNode(Node):
+    def render(self, context):
+        return u''
+
+@register.tag
+def paginate(parser, token):
+    return PaginateNode()
diff --git a/postman/templatetags/pagination_tags_for_tests.py b/postman/templatetags/pagination_tags_for_tests.py
deleted file mode 100644 (file)
index 014d8a3..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-"""
-A mock of django-pagination's pagination_tags.py that do nothing.
-Just to avoid failures in template rendering during the test suite,
-if the real application is not installed.
-
-To activate this mock, just rename it to ``pagination_tags.py``
-for the time of the test session.
-"""
-from django.template import Node, Library
-
-register = Library()
-
-class AutoPaginateNode(Node):
-    def render(self, context):
-        return u''
-
-@register.tag
-def autopaginate(parser, token):
-    return AutoPaginateNode()
-
-class PaginateNode(Node):
-    def render(self, context):
-        return u''
-
-@register.tag
-def paginate(parser, token):
-    return PaginateNode()
index 0a535dc53b2787668b09c7d57f7a0e86e938e8cc..b0449c138cf6886e2c28b5f01ee9fdee1fd6a71e 100644 (file)
@@ -61,16 +61,6 @@ from postman.urls import OPTION_MESSAGES
 # because of reload()'s, do "from postman.utils import notification" just before needs
 from postman.utils import format_body, format_subject
 
-if not 'pagination' in settings.INSTALLED_APPS:
-    try:
-        import postman.templatetags.pagination_tags
-    except:
-        sys.exit(
-            "Some templates need templatetags from the django-pagination application.\n"
-            "Add it to the INSTALLED_APPS, or allow a mock by renaming\n"
-            "postman/templatetags/pagination_tags_for_tests.py to pagination_tags.py"
-        )
-
 class GenericTest(TestCase):
     """
     Usual generic tests.