Author: floguy
Date: Sat Sep 20 23:34:18 2008
New Revision: 22

Modified:
    trunk/things/options.py

Log:
Added hooks for customizing the chosen template and template directory.

Modified: trunk/things/options.py
==============================================================================
--- trunk/things/options.py     (original)
+++ trunk/things/options.py     Sat Sep 20 23:34:18 2008
@@ -28,6 +28,7 @@
      fields = {}
      detail_template_name = None
      list_template_name = None
+    template_dir = 'things'
      search = []

      def __init__(self, qs):
@@ -37,9 +38,9 @@
              field.parent = self
              field.field_name = name
          if not self.detail_template_name:
-            self.detail_template_name = self.qs.model._meta.module_name
+            self.detail_template_name = '%s_detail.html' %  
self.qs.model._meta.module_name
          if not self.list_template_name:
-            self.list_template_name = self.qs.model._meta.module_name
+            self.list_template_name = '%s_list.html' %  
self.qs.model._meta.module_name

      def list_view(self, request, descending=False, field=None,
          template_object_name='objects', template_name=None, **kwargs):
@@ -59,8 +60,8 @@
              if descending == True:
                  pre = '-'
              items = items.order_by('%s%s' % (pre, field.field_name))
-        templates = ['things/%s_list.html' % (template_name,),
-            'things/list.html']
+        templates = ['%s/%s' % (self.template_dir, template_name,),
+            '%s/list.html' % self.template_dir, 'things/list.html']
          t = select_template(templates)
          c = RequestContext(request, {
              template_object_name: items,
@@ -85,8 +86,8 @@
          list_url = reverse('%s_list' % (self.name_prefix,), kwargs={
              'url_prefix': self.url_prefix,
          })
-        templates = ['things/%s_detail.html' % (template_name,),
-            'things/detail.html']
+        templates = ['%s/%s' % (self.template_dir, template_name,),
+            '%s/detail.html' % self.template_dir, 'things/detail.html']
          t = select_template(templates)
          c = RequestContext(request, {
              template_object_name: obj,

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to