本文整理汇总了Python中models.Record.update_links方法的典型用法代码示例。如果您正苦于以下问题:Python Record.update_links方法的具体用法?Python Record.update_links怎么用?Python Record.update_links使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Record
的用法示例。
在下文中一共展示了Record.update_links方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save
# 需要导入模块: from models import Record [as 别名]
# 或者: from models.Record import update_links [as 别名]
def save(self, record=None):
if record:
links = []
if self.validated_data['gwc']:
gwc_endpoints = [endpoint.strip() for endpoint in self.validated_data['gwc_endpoint'].split("^") if endpoint.strip()]
for endpoint in gwc_endpoints:
links.append(
record.generate_ows_link(endpoint, 'GWC', self.validated_data['wms_version'])
)
elif self.validated_data['wms']:
links.append(
record.generate_ows_link(self.validated_data['wms_endpoint'], 'WMS', self.validated_data['wms_version'])
)
if self.validated_data['wfs']:
links.append(
record.generate_ows_link(self.validated_data['wfs_endpoint'], 'WFS', self.validated_data['wfs_version'])
)
if record.service_type == "WMS":
record.service_type_version = self.validated_data['wms_version']
elif record.service_type == "WFS":
record.service_type_version = self.validated_data['wfs_version']
else:
record.service_type_version = ""
style_links = record.style_links
resources = links + style_links
Record.update_links(resources, record)
示例2: save
# 需要导入模块: from models import Record [as 别名]
# 或者: from models.Record import update_links [as 别名]
def save(self,record=None):
if record:
links = []
if self.validated_data['gwc']:
links.append(
json.loads(Record.generate_ows_link(self.validated_data['gwc_endpoint'],'WMS',None,record))
)
if self.validated_data['wms']:
links.append(
json.loads(Record.generate_ows_link(self.validated_data['wms_endpoint'],'WMS',self.validated_data['wms_version'],record))
)
if self.validated_data['wfs']:
links.append(
json.loads(Record.generate_ows_link(self.validated_data['wfs_endpoint'],'WFS',self.validated_data['wfs_version'],record))
)
if record.service_type == "WMS":
record.service_type_version = self.validated_data['wms_version']
elif record.service_type == "WFS":
record.service_type_version = self.validated_data['wfs_version']
else:
record.service_type_version = ""
style_resources = record.style_resources
resources = links + style_resources
Record.update_links(resources,record)