append object type next to object title in related docs
This commit is contained in:
parent
424b6d3004
commit
46a4ede740
|
@ -14,6 +14,7 @@ from Products.CMFCore.utils import getToolByName
|
|||
|
||||
from plone.registry.interfaces import IRegistry
|
||||
from plone.formwidget.contenttree import ObjPathSourceBinder
|
||||
from plone.formwidget.contenttree.source import ObjPathSource
|
||||
|
||||
try:
|
||||
from tabellio.config.interfaces import ITabellioSettings
|
||||
|
@ -334,7 +335,19 @@ class LegislativeSessionsSource(object): # Legislative sessions
|
|||
# hack to let schema editor handle the field
|
||||
yield u'DO NOT TOUCH'
|
||||
|
||||
class RelatedDocObjPathSource(ObjPathSource):
|
||||
def getTermByBrain(self, brain, real_value=True):
|
||||
if real_value:
|
||||
value = brain._unrestrictedGetObject()
|
||||
else:
|
||||
value = brain.getPath()[len(self.portal_path):]
|
||||
return SimpleTerm(value, token=brain.getPath(), title=u'%s [%s]' % (
|
||||
unicode(brain.Title, 'utf-8'),
|
||||
brain.getObject().Type()))
|
||||
|
||||
class RelatedDocObjPathSourceBinder(ObjPathSourceBinder):
|
||||
path_source = RelatedDocObjPathSource
|
||||
|
||||
def __iter__(self):
|
||||
# hack to let schema editor handle the field
|
||||
yield u'DO NOT TOUCH'
|
||||
|
|
Reference in New Issue