本文整理汇总了Python中models.Location.featured方法的典型用法代码示例。如果您正苦于以下问题:Python Location.featured方法的具体用法?Python Location.featured怎么用?Python Location.featured使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Location
的用法示例。
在下文中一共展示了Location.featured方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_location
# 需要导入模块: from models import Location [as 别名]
# 或者: from models.Location import featured [as 别名]
def add_location(data, location_key=""):
if location_key:
location = Location.get_by_id(location_key)
else:
location_id = slugify(data["name"])
temp_location_id = location_id
while True:
count = 1
if Location.get_by_id(temp_location_id):
temp_location_id = location_id + str(count)
count += 1
else:
location = Location(id=temp_location_id)
break
if data["name"]:
location.name = data["name"]
if data["needs"]:
location.needs = data["needs"]
if data["centers"]:
location.centers = data["centers"]
if data["latlong"]:
location.latlong = data["latlong"]
if data["featured_photo"]:
location.featured_photo = data["featured_photo"]
if data["death_count"]:
location.death_count = int(data["death_count"])
if data["death_count_text"]:
location.death_count_text = data["death_count_text"]
if data["affected_count"]:
location.affected_count = int(data["affected_count"])
if data["affected_count_text"]:
location.affected_count_text = data["affected_count_text"]
if data["status_board"]:
location.status_board = data["status_board"]
if data["needs"]:
location.needs = data["needs"]
if data["status"]:
location.status = data["status"]
if data["images"]:
location.images = data["images"]
if data["hash_tag"]:
location.hash_tag = data["hash_tag"]
if data["featured"]:
location.featured = data["featured"]
if data["missing_person"]:
location.missing_person = data["missing_person"]
if data["missing_person_text"]:
location.missing_person_text = data["missing_person_text"]
location.put()
return location