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


Python Species.is_native方法代码示例

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


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

示例1: setupTreemapEnv

# 需要导入模块: from treemap.models import Species [as 别名]
# 或者: from treemap.models.Species import is_native [as 别名]
def setupTreemapEnv():
    def local_render_to_response(*args, **kwargs):
        from django.template import loader
        from django.http import HttpResponse

        httpresponse_kwargs = {'mimetype': kwargs.pop('mimetype', None)}
        hr = HttpResponse(
            loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)

        if hasattr(args[1], 'dicts'):
            hr.request_context = args[1].dicts

        return hr

    django.shortcuts.render_to_response = local_render_to_response

    instance = make_instance(is_public=True)
    create_stewardship_udfs(instance)

    make_user_with_default_role(instance, 'jim')
    commander = make_commander_user(instance, 'commander')
    make_apprentice_user(instance, 'apprentice')

    n1geom = MultiPolygon(Polygon(
        ((0, 0), (100, 0), (100, 100), (0, 100), (0, 0))))

    n2geom = MultiPolygon(
        Polygon(((0, 101), (101, 101), (101, 200), (0, 200), (0, 101))))

    n1 = Boundary(name="n1", category='blah', sort_order=4, geom=n1geom)
    n2 = Boundary(name="n2", category='blah', sort_order=4, geom=n2geom)

    n1.save()
    n2.save()

    s1 = Species(otm_code="s1", genus="testus1", species="specieius1",
                 cultivar='', instance=instance)
    s2 = Species(otm_code="s2", genus="testus2", species="specieius2",
                 cultivar='', instance=instance)
    s3 = Species(otm_code="s3", genus="testus2", species="specieius3",
                 cultivar='', instance=instance)

    s1.is_native = True
    s1.fall_conspicuous = True
    s1.flower_conspicuous = True
    s1.palatable_human = True

    s2.is_native = True
    s2.fall_conspicuous = False
    s2.flower_conspicuous = True
    s2.palatable_human = False
    s2.has_wildlife_value = True

    s3.has_wildlife_value = True

    s1.save_with_user(commander)
    s2.save_with_user(commander)
    s3.save_with_user(commander)

    return instance
开发者ID:JoshIUSBStudent,项目名称:otm-core,代码行数:62,代码来源:test_utils.py


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