当前位置: 首页>>代码示例>>Python>>正文


Python Location.affected_count方法代码示例

本文整理汇总了Python中models.Location.affected_count方法的典型用法代码示例。如果您正苦于以下问题:Python Location.affected_count方法的具体用法?Python Location.affected_count怎么用?Python Location.affected_count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Location的用法示例。


在下文中一共展示了Location.affected_count方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add_location

# 需要导入模块: from models import Location [as 别名]
# 或者: from models.Location import affected_count [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"]

    location.put()
    return location
开发者ID:rileonard15,项目名称:bangonph,代码行数:61,代码来源:functions.py


注:本文中的models.Location.affected_count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。