misc: add get_admin_url to various objects (#45834)
This commit is contained in:
parent
aa0aacfb04
commit
38edbfe0f1
|
@ -87,6 +87,10 @@ class BlockDef(StorableObject):
|
|||
def get_new_field_id(self):
|
||||
return 'bf%s' % str(uuid.uuid4())
|
||||
|
||||
def get_admin_url(self):
|
||||
base_url = get_publisher().get_backoffice_url()
|
||||
return '%s/forms/blocks/%s/' % (base_url, self.id)
|
||||
|
||||
def get_display_value(self, value):
|
||||
if not self.digest_template:
|
||||
return self.name
|
||||
|
|
|
@ -373,6 +373,15 @@ class NamedDataSource(XmlStorableObject):
|
|||
new_slug = '%s-%s' % (base_new_slug, suffix_no)
|
||||
return new_slug
|
||||
|
||||
def get_admin_url(self):
|
||||
base_url = get_publisher().get_backoffice_url()
|
||||
for section in ('settings', 'forms', 'workflows'):
|
||||
if get_publisher().get_backoffice_root().is_accessible(section):
|
||||
return '%s/%s/data-sources/%s/' % (base_url, section, self.id)
|
||||
# fallback to settings section
|
||||
section = 'settings'
|
||||
return '%s/%s/data-sources/%s/' % (base_url, section, self.id)
|
||||
|
||||
def export_data_source_to_xml(self, element, attribute_name, charset):
|
||||
data_source = getattr(self, attribute_name)
|
||||
ET.SubElement(element, 'type').text = data_source.get('type')
|
||||
|
|
|
@ -142,6 +142,10 @@ class NamedWsCall(XmlStorableObject):
|
|||
XmlStorableObject.__init__(self)
|
||||
self.name = name
|
||||
|
||||
def get_admin_url(self):
|
||||
base_url = get_publisher().get_backoffice_url()
|
||||
return '%s/settings/wscalls/%s/' % (base_url, self.slug)
|
||||
|
||||
def export_request_to_xml(self, element, attribute_name, charset):
|
||||
request = getattr(self, attribute_name)
|
||||
for attr in ('url', 'request_signature_key', 'method'):
|
||||
|
|
Loading…
Reference in New Issue