Add '__scoped__' as a special filter
authorSverre Rabbelier <srabbelier@gmail.com>
Wed, 11 Feb 2009 23:52:11 +0000
changeset 1271 3bd4a3b527d7
parent 1270 a48a592919b0
child 1272 c17e47db4875
Add '__scoped__' as a special filter It sets the scope_path to the entity's key().value(). Patch by: Sverre Rabbelier
app/soc/views/helper/templatetags/forms_helpers.py
--- a/app/soc/views/helper/templatetags/forms_helpers.py	Wed Feb 11 23:49:44 2009 +0000
+++ b/app/soc/views/helper/templatetags/forms_helpers.py	Wed Feb 11 23:52:11 2009 +0000
@@ -252,6 +252,9 @@
       for filter_field in (i for i in filter if hasattr(entity, i)):
         args[filter_field] = getattr(entity, filter_field)
 
+      if '__scoped__' in filter:
+        args['scope_path'] = entity.key().name()
+
       params['args'] = '&'.join(['%s=%s' % item for item in args.iteritems()])
 
     select_url = redirects.getSelectRedirect(params)
@@ -273,7 +276,7 @@
       'help_text': force_unicode(help_text) if help_text else '',
       'field_class_type': field_class_type,
       'label': force_unicode(label) if field.label else '',
-      'field': unicode(field),
+      'field': field,
       'field_id': field.auto_id,
       'required': required,
       'example_text': example_text,