'pagination_tags' is not a valid tag library

Issue #10 invalid
Former user created an issue

I followed your instruction how to install after that I got an error when accessing postman any tips?

'pagination_tags' is not a valid tag library: Template library pagination_tags not found In template /usr/local/lib/python2.7/dist-packages/django_postman-1.2.0-py2.7.egg/postman/templates/postman/base_folder.html, error at line 3

Comments (8)

  1. Patrick Samson repo owner

    The templates provided with the application are basically a starter kit to design your owns. Using a pagination app is very likely, so it's the default case.

    You have to choose one of these options:

    - write your own templates, without references to the pagination_tags library

    - put a compatible pagination app in INSTALLED_APPS, such as django-pagination (advised)

    - use a temporary mock (as the one for the test suite, refer to https://bitbucket.org/psam/django-postman/wiki/Tags_and_Filters) (discouraged for production)

  2. Former user Account Deleted

    I would highly appreciate the use of the builtin django.core.paginator as default, which makes this dependency redundant. Or is there a reason not to use it?

  3. Patrick Samson repo owner

    You can use any paginator you want or none. Just use your templates by overriding the default ones. In that case, implement your <path in Settings.TEMPLATE_DIRS>/postman/base_folder.html

  4. Former user Account Deleted

    I know and this is good. But why (force to) use a dependency when django comes with a builtin way to paginate, which by the way does pagination the mathematical way it should be done -> is very fast even if there are thousands of db entries to paginate (maybe others do this too, I never checked).

    e.g. with a POSTMAN_MSGS_PER_PAGE in settings:

    #views.py from django.core.paginator import Paginator

    def _folder(...

    page = request.GET.get('page',1)

    msgs_qry = getattr(Message.objects, folder_name)(request.user, **kwargs)

    djpaginator = Paginator(msgs_qry, POSTMAN_MSGS_PER_PAGE)

    msgs = djpaginator.page(page)

    return {'pm_messages': msgs, ...}

    You instantly get results this way with the existing templates without changing anything but removing the external pagination tags (which throw the error above). All you have to add for full pagination functionality is a bit of html for navigating through the pages (e.g. a button with ?page=x). I think less dependencies are a good thing, and you can always opt to an external solution if you want to.

  5. Patrick Samson repo owner

    Once again, there is no dependency and you are not forced to paginate, the provided templates are a starter kit for the app to be runnable effortless, but it is very likely you will design your owns. You don't want your site to look like any other, don't you? :) django-pagination is just a helper based internally on django.core.paginator, and it has some great advantages: a) there is no need to modify the views of the app to paginate, contrary to your piece of code above (what about your primary concern of no dependency, if you do not want to paginate or want to paginate your own custom way?). b) it takes care of all the boring prev/next plumbing and it remains parametrizable through the settings.

  6. Patrick Samson repo owner

    To remove the ambiguity, the reference to a pagination app will be removed from the default templates. More precisely, it will be a mock. So the default setup is inverted : there will be no real pagination on a fresh installation and if you want one, it has to be activated.

  7. Log in to comment