<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Digg-style pagination in Django</title>
	<atom:link href="http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/</link>
	<description>Everything you&#039;ve ever thought, but never had the balls to say.</description>
	<lastBuildDate>Fri, 19 Feb 2010 04:53:04 -1000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: sabueso</title>
		<link>http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/comment-page-1/#comment-30142</link>
		<dc:creator>sabueso</dc:creator>
		<pubDate>Thu, 26 Nov 2009 15:40:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/#comment-30142</guid>
		<description>Wow! Why do you delete my comment? I said ironically &quot;snippet&quot; ...btw , good job! (and now i hope not delete the comment..) xD</description>
		<content:encoded><![CDATA[<p>Wow! Why do you delete my comment? I said ironically &#8220;snippet&#8221; &#8230;btw , good job! (and now i hope not delete the comment..) xD</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sabueso</title>
		<link>http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/comment-page-1/#comment-30141</link>
		<dc:creator>sabueso</dc:creator>
		<pubDate>Wed, 25 Nov 2009 22:00:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/#comment-30141</guid>
		<description>Good &quot;snippet&quot; xDD</description>
		<content:encoded><![CDATA[<p>Good &#8220;snippet&#8221; xDD</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: panchicore</title>
		<link>http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/comment-page-1/#comment-30035</link>
		<dc:creator>panchicore</dc:creator>
		<pubDate>Sun, 21 Jun 2009 13:44:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/#comment-30035</guid>
		<description>Hi. great work man!!!. 

why do I have to modify my view, if you said &quot;you only need to modify your template&quot;?

my original view:

def index(request):
    productos = Producto.objects.all()
    return render_to_response(&#039;productos/index.html&#039;, 
                             {&#039;productos&#039;: productos
                             })

view modified to:

from django.template import RequestContext

def index(request):
    productos = Producto.objects.all()
    return render_to_response(&#039;productos/index.html&#039;, 
                             {&#039;productos&#039;: productos
                             }, context_instance=RequestContext(request))</description>
		<content:encoded><![CDATA[<p>Hi. great work man!!!. </p>
<p>why do I have to modify my view, if you said &#8220;you only need to modify your template&#8221;?</p>
<p>my original view:</p>
<p>def index(request):<br />
    productos = Producto.objects.all()<br />
    return render_to_response(&#8216;productos/index.html&#8217;,<br />
                             {&#8216;productos&#8217;: productos<br />
                             })</p>
<p>view modified to:</p>
<p>from django.template import RequestContext</p>
<p>def index(request):<br />
    productos = Producto.objects.all()<br />
    return render_to_response(&#8216;productos/index.html&#8217;,<br />
                             {&#8216;productos&#8217;: productos<br />
                             }, context_instance=RequestContext(request))</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ryankanno</title>
		<link>http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/comment-page-1/#comment-29982</link>
		<dc:creator>ryankanno</dc:creator>
		<pubDate>Fri, 20 Mar 2009 04:17:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/#comment-29982</guid>
		<description>@Paul

I&#039;ve always wondered the same.  There have been better OO approaches to the same problem (including yours), but the implementation was so simple that I didn&#039;t mind it being dirty at the time. :)  I took a look at your solution, and I love it. +1 :)</description>
		<content:encoded><![CDATA[<p>@Paul</p>
<p>I&#8217;ve always wondered the same.  There have been better OO approaches to the same problem (including yours), but the implementation was so simple that I didn&#8217;t mind it being dirty at the time. <img src='http://blog.localkinegrinds.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   I took a look at your solution, and I love it. +1 <img src='http://blog.localkinegrinds.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Kenjora</title>
		<link>http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/comment-page-1/#comment-29981</link>
		<dc:creator>Paul Kenjora</dc:creator>
		<pubDate>Fri, 20 Mar 2009 00:51:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/#comment-29981</guid>
		<description>Nice approach, I&#039;ve aways wondered why Django doesn&#039;t have a generic built in tag for this. I implemented a similar solution but I didn&#039;t use any context variables.  Basically the tag takes an object query and re-casts it into a new object.  The upside is that there is no query overhead as Django is lazy with queries. It also makes for a simple integration, just one line of code and no need to re-code the handler (except current page).

&lt;a href=&quot;http://blog.awarelabs.com/?p=84&quot; rel=&quot;nofollow&quot;&gt;Digg Style Pagination In Django Revisited&lt;/a&gt;

I focused on doing a single pass for loop, the idea was to save loop time.   Anyway I just thought I&#039;d let you know I used one of your images on my re-post regarding pagination in Django.

-Paul</description>
		<content:encoded><![CDATA[<p>Nice approach, I&#8217;ve aways wondered why Django doesn&#8217;t have a generic built in tag for this. I implemented a similar solution but I didn&#8217;t use any context variables.  Basically the tag takes an object query and re-casts it into a new object.  The upside is that there is no query overhead as Django is lazy with queries. It also makes for a simple integration, just one line of code and no need to re-code the handler (except current page).</p>
<p><a href="http://blog.awarelabs.com/?p=84" rel="nofollow">Digg Style Pagination In Django Revisited</a></p>
<p>I focused on doing a single pass for loop, the idea was to save loop time.   Anyway I just thought I&#8217;d let you know I used one of your images on my re-post regarding pagination in Django.</p>
<p>-Paul</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Digg Style Pagination In Django Revisited &#124; Django Aware</title>
		<link>http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/comment-page-1/#comment-29980</link>
		<dc:creator>Digg Style Pagination In Django Revisited &#124; Django Aware</dc:creator>
		<pubDate>Fri, 20 Mar 2009 00:12:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/#comment-29980</guid>
		<description>[...] This image was Google Image borrowed from Ryan Kanno [...]</description>
		<content:encoded><![CDATA[<p>[...] This image was Google Image borrowed from Ryan Kanno [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Klaus Laube</title>
		<link>http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/comment-page-1/#comment-29969</link>
		<dc:creator>Klaus Laube</dc:creator>
		<pubDate>Fri, 27 Feb 2009 12:14:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/#comment-29969</guid>
		<description>Thanks guy! Genious... genious...</description>
		<content:encoded><![CDATA[<p>Thanks guy! Genious&#8230; genious&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cs</title>
		<link>http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/comment-page-1/#comment-29967</link>
		<dc:creator>cs</dc:creator>
		<pubDate>Mon, 23 Feb 2009 20:27:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/#comment-29967</guid>
		<description>Useful Tag. I started building the paginator in my own way till I stumbled upon this. 
My question is if my base_url contains other get params like http://www.someurl.com/page?type=&#039;x&#039;
how can i add the page=&#039;x&#039; to this. base_url does not seem to give me the entire url, it gives it only till http://www.someurl.com/page.</description>
		<content:encoded><![CDATA[<p>Useful Tag. I started building the paginator in my own way till I stumbled upon this.<br />
My question is if my base_url contains other get params like <a href="http://www.someurl.com/page?type=" rel="nofollow">http://www.someurl.com/page?type=</a>&#8216;x&#8217;<br />
how can i add the page=&#8217;x&#8217; to this. base_url does not seem to give me the entire url, it gives it only till <a href="http://www.someurl.com/page" rel="nofollow">http://www.someurl.com/page</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Manisha</title>
		<link>http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/comment-page-1/#comment-29926</link>
		<dc:creator>Manisha</dc:creator>
		<pubDate>Tue, 20 Jan 2009 17:37:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/#comment-29926</guid>
		<description>Thanks Ryan for the reply.

Your basic code works fine with GAE too, except I haven&#039;t tried to make it a tag. Here is my code (a simple port of your code).


   
   &lt;pre&gt;
   
    def get(self, page=1):

        try:
            page = int(page)      
        except:            
            page = 1

        data = MyData.all().order(&#039;keyname&#039;)
                
        paginator = ObjectPaginator(data,10)

        if page&gt;=paginator.pages:            
            page = paginator.pages

        in_leading_range = in_trailing_range = False
        pages_outside_leading_range = pages_outside_trailing_range = range(0)
        context_pages = paginator.pages
 
        if (context_pages  0 and n &lt;= context_pages]           
        elif (page  0 and n  context_pages - TRAILING_PAGE_RANGE):
            in_trailing_range = True
            page_numbers = [n for n in range(context_pages - TRAILING_PAGE_RANGE_DISPLAYED + 1, context_pages + 1) if n &gt; 0 and n  0 and n &lt;= context_pages]
            pages_outside_leading_range = [n + context_pages for n in range(0, -NUM_PAGES_OUTSIDE_RANGE, -1)]
            pages_outside_trailing_range = [n + 1 for n in range(0, NUM_PAGES_OUTSIDE_RANGE)]

        
        template_values = {

            &#039;data&#039;:paginator.get_page(page-1),
            &quot;base_url&quot;: &quot;/BrowsemyData&quot;,
            &quot;previous&quot;: page-1,
            &quot;has_previous&quot;: paginator.has_previous_page(page-1),
            &quot;next&quot;: page+1,
            &quot;has_next&quot;: paginator.has_next_page(page-1),
            &quot;results_per_page&quot;: 10,
            &quot;page&quot;: page,
            &quot;pages&quot;: context_pages,
            &quot;page_numbers&quot;: page_numbers,
            &quot;in_leading_range&quot; : in_leading_range,
            &quot;in_trailing_range&quot; : in_trailing_range,
            &quot;pages_outside_leading_range&quot;: pages_outside_leading_range,
            &quot;pages_outside_trailing_range&quot;: pages_outside_trailing_range
            
        }
                  
        path = os.path.join(os.path.dirname(__file__), &#039;templates/sample.html&#039;)
        self.response.out.write(template.render(path,template_values))
   &lt;/pre&gt;
   
 

I used your digg_paginator.html and css with minor modifications. It works like a charm, you can check it out at my website &lt;a href=&quot;http://www.pitarau.com&quot; rel=&quot;nofollow&quot;&gt;Indian Baby Names&lt;/a&gt;.

Thanks for the code.</description>
		<content:encoded><![CDATA[<p>Thanks Ryan for the reply.</p>
<p>Your basic code works fine with GAE too, except I haven&#8217;t tried to make it a tag. Here is my code (a simple port of your code).</p>
<pre>

    def get(self, page=1):

        try:
            page = int(page)
        except:
            page = 1

        data = MyData.all().order('keyname')

        paginator = ObjectPaginator(data,10)

        if page&gt;=paginator.pages:
            page = paginator.pages

        in_leading_range = in_trailing_range = False
        pages_outside_leading_range = pages_outside_trailing_range = range(0)
        context_pages = paginator.pages

        if (context_pages  0 and n &lt;= context_pages]
        elif (page  0 and n  context_pages - TRAILING_PAGE_RANGE):
            in_trailing_range = True
            page_numbers = [n for n in range(context_pages - TRAILING_PAGE_RANGE_DISPLAYED + 1, context_pages + 1) if n &gt; 0 and n  0 and n &lt;= context_pages]
            pages_outside_leading_range = [n + context_pages for n in range(0, -NUM_PAGES_OUTSIDE_RANGE, -1)]
            pages_outside_trailing_range = [n + 1 for n in range(0, NUM_PAGES_OUTSIDE_RANGE)]

        template_values = {

            'data':paginator.get_page(page-1),
            "base_url": "/BrowsemyData",
            "previous": page-1,
            "has_previous": paginator.has_previous_page(page-1),
            "next": page+1,
            "has_next": paginator.has_next_page(page-1),
            "results_per_page": 10,
            "page": page,
            "pages": context_pages,
            "page_numbers": page_numbers,
            "in_leading_range" : in_leading_range,
            "in_trailing_range" : in_trailing_range,
            "pages_outside_leading_range": pages_outside_leading_range,
            "pages_outside_trailing_range": pages_outside_trailing_range

        }

        path = os.path.join(os.path.dirname(__file__), 'templates/sample.html')
        self.response.out.write(template.render(path,template_values))
   </pre>
<p>I used your digg_paginator.html and css with minor modifications. It works like a charm, you can check it out at my website <a href="http://www.pitarau.com" rel="nofollow">Indian Baby Names</a>.</p>
<p>Thanks for the code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ryankanno</title>
		<link>http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/comment-page-1/#comment-29921</link>
		<dc:creator>ryankanno</dc:creator>
		<pubDate>Mon, 19 Jan 2009 22:43:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/#comment-29921</guid>
		<description>@Manisha - I&#039;m actually in the process of migrating a ton of things to GAE.  There are other tags out there that are probably doing things in a better fashion since I just threw this up.  I&#039;ll probably work on the migration into GAE and post any updates to this code that I might have.  Or... if you&#039;d like to, feel free to link to it from here! :)</description>
		<content:encoded><![CDATA[<p>@Manisha &#8211; I&#8217;m actually in the process of migrating a ton of things to GAE.  There are other tags out there that are probably doing things in a better fashion since I just threw this up.  I&#8217;ll probably work on the migration into GAE and post any updates to this code that I might have.  Or&#8230; if you&#8217;d like to, feel free to link to it from here! <img src='http://blog.localkinegrinds.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
