Author: floguy
Date: Sat Sep 20 20:54:35 2008
New Revision: 20
Modified:
trunk/things/templatetags/things_tags.py
Log:
Added a get_absolute_url try first before defaulting to the things object
detail page.
Modified: trunk/things/templatetags/things_tags.py
==============================================================================
--- trunk/things/templatetags/things_tags.py (original)
+++ trunk/things/templatetags/things_tags.py Sat Sep 20 20:54:35 2008
@@ -4,9 +4,12 @@
register = template.Library()
def item_url(url_prefix, name_prefix, item):
- return reverse('%s_detail' % name_prefix, kwargs={
- 'url_prefix': url_prefix,
- 'pk': item.pk,
- })
+ try:
+ return item.get_absolute_url()
+ except AttributeError:
+ return reverse('%s_detail' % name_prefix, kwargs={
+ 'url_prefix': url_prefix,
+ 'pk': item.pk,
+ })
register.simple_tag(item_url)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---