Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justquick/1102841 to your computer and use it in GitHub Desktop.
Save justquick/1102841 to your computer and use it in GitHub Desktop.
From a819adabae87570827c475a0ad0d556f9b1e8517 Mon Sep 17 00:00:00 2001
From: Justin Quick <justquick@gmail.com>
Date: Sun, 24 Jul 2011 13:09:43 -0400
Subject: [PATCH] fixed import loop errors in endless pag
---
apps/endless_pagination/models.py | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/apps/endless_pagination/models.py b/apps/endless_pagination/models.py
index 664e9d5..afa608d 100644
--- a/apps/endless_pagination/models.py
+++ b/apps/endless_pagination/models.py
@@ -1,10 +1,11 @@
-from django.template import Context, loader
+from django.template import Context
+from django.template.loader import render_to_string, get_template
from endless_pagination import settings, utils
# preload page templates
-PAGE_TEMPLATE = loader.get_template("endless/page_link.html")
-CURRENT_TEMPLATE = loader.get_template("endless/current_link.html")
+PAGE_TEMPLATE = "endless/page_link.html"
+CURRENT_TEMPLATE = "endless/current_link.html"
class EndlessPage(object):
"""
@@ -43,7 +44,7 @@ class EndlessPage(object):
'querystring_key': self.querystring_key,
})
template = CURRENT_TEMPLATE if self.is_current else PAGE_TEMPLATE
- return template.render(context_instance)
+ return get_template(template).render(context_instance)
class PageList(object):
@@ -128,7 +129,7 @@ class PageList(object):
else:
pages.append(self[i])
context = {'pages': pages}
- return loader.render_to_string("endless/show_pages.html", context)
+ return render_to_string("endless/show_pages.html", context)
return u""
def current(self):
--
1.7.4+GitX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment