sangdongvan / django-pagination

Automatically exported from code.google.com/p/django-pagination due to issue syntax errors when running python3
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Making it work with Jinja2 (coffin) #61

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. use Jinja2 as template engine via coffin (http://github.com/dcramer/coffin)
2. overriding pagination/pagination.html with own Jinja2 template
3. pagination templatetags are unknown

   TemplateSyntaxError: unknown tag 'autopaginate' File ...

   Try to add them:

from coffin.template import Library
from pagination.templatetags import pagination_tags
from jinja2 import contextfunction

#make django pagination work with jinja2
register = Library()

#make paginate a contextfunction in jinja2
paginate = contextfunction(pagination_tags.paginate)
paginate = register.object(paginate)

autopaginate = register.tag('autopaginate', pagination_tags.do_autopaginate)

What is the expected output? What do you see instead?
A paginated view. An exception.

What version of the product are you using? On what operating system?
1.0.5
Ubuntu 9.10

Please provide any additional information below.
None that I can think of.

Cheers for any help!

Original issue reported on code.google.com by sportjun...@gmail.com on 17 Dec 2009 at 9:55

GoogleCodeExporter commented 8 years ago
https://gist.github.com/673954

Original comment by chaplins...@gmail.com on 15 Nov 2010 at 12:52