Author: david.michon
Date: Fri May 1 05:42:56 2009
New Revision: 491
Modified:
branches/electron/pages/urls.py
branches/electron/pages/views.py
Log:
Update to handle ajax call to backend via dodo
Modified: branches/electron/pages/urls.py
==============================================================================
--- branches/electron/pages/urls.py (original)
+++ branches/electron/pages/urls.py Fri May 1 05:42:56 2009
@@ -9,5 +9,9 @@
)
urlpatterns += patterns('',
+ url(r'^.*?/?(?P<slug>[-\w]+)/ajax/$', details, {'ajax':True},
name='pages-details-by-slug'),
+)
+
+urlpatterns += patterns('',
url(r'^.*?/?(?P<slug>[-\w]+)/$', details,
name='pages-details-by-slug'),
)
Modified: branches/electron/pages/views.py
==============================================================================
--- branches/electron/pages/views.py (original)
+++ branches/electron/pages/views.py Fri May 1 05:42:56 2009
@@ -7,7 +7,7 @@
from pages.utils import auto_render, get_language_from_request,
get_page_from_slug
-def details(request, slug=None, lang=None):
+def details(request, slug=None, lang=None, ajax=False):
"""
This example view get the root pages for navigation
and the current page to display if there is any.
@@ -50,8 +50,13 @@
# return this object if you want to activate redirections
http_redirect = HttpResponsePermanentRedirect(
current_page.redirect_to.get_absolute_url(lang))
-
+
template_name = current_page.get_template()
+
+ if ajax:
+ new_template_name = "body_%s" % template_name
+ return new_template_name, locals()
+
return template_name, locals()
details = auto_render(details)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---