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


Python Species.save方法代码示例

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


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

示例1: EcoTest

# 需要导入模块: from treemap.models import Species [as 别名]
# 或者: from treemap.models.Species import save [as 别名]
class EcoTest(TestCase):
    def setUp(self):
        self.factory = RequestFactory()

        self.instance, system_user = tm.make_instance_and_system_user()

        self.user = User(username="commander")
        self.user.save_with_user(system_user)
        self.user.roles.add(tm.make_commander_role(self.instance))

        self.species = Species(symbol='CEDR',
                               genus='cedrus',
                               species='atlantica',
                               max_dbh=2000,
                               max_height=100)
        self.species.save()

        p1 = Point(-8515941.0, 4953519.0)
        self.plot = Plot(geom=p1,
                         instance=self.instance,
                         created_by=self.user)

        self.plot.save_with_user(self.user)

        self.tree = Tree(plot=self.plot,
                         instance=self.instance,
                         readonly=False,
                         species=self.species,
                         diameter=1630,
                         created_by=self.user)

        self.tree.save_with_user(self.user)

    def test_group_eco(self):
        pass  # TODO: Once filtering has been enabled

    def test_eco_benefit_sanity(self):
        req = self.factory.get('/%s/eco/benefit/tree/%s/' %
                              (self.instance.pk, self.tree.pk))

        response = tree_benefits(req,
                                 instance_id=self.instance.pk,
                                 tree_id=self.tree.pk,
                                 region='NoEastXXX')

        self.assertEqual(response.status_code, 200)
        rslt = json.loads(response.content)

        bens = rslt['benefits']

        def assertBValue(benefit, unit, value):
            self.assertEqual(bens[benefit]['unit'], unit)
            self.assertEqual(int(float(bens[benefit]['value'])), value)

        assertBValue('energy', 'kwh', 1896)
        assertBValue('airquality', 'lbs/year', 6)
        assertBValue('stormwater', 'gal', 3185)
        assertBValue('co2', 'lbs/year', 563)
开发者ID:balexandrowicz,项目名称:OTM2,代码行数:60,代码来源:tests.py

示例2: commit_row

# 需要导入模块: from treemap.models import Species [as 别名]
# 或者: from treemap.models.Species import save [as 别名]
    def commit_row(self):
        # First validate
        if not self.validate_row():
            return False

        # Get our data
        data = self.cleaned

        species_edited = False

        # Initially grab species from row if it exists
        # and edit it
        species = self.species

        # If not specified create a new one
        if species is None:
            species = Species()

        # Convert units
        self.convert_units(data, {
            fields.species.MAX_DIAMETER:
            self.import_event.max_diameter_conversion_factor,

            fields.species.MAX_HEIGHT:
            self.import_event.max_tree_height_conversion_factor
        })

        #TODO: Update tree count nonsense

        for modelkey, importdatakey in SpeciesImportRow.SPECIES_MAP.iteritems():
            importdata = data.get(importdatakey, None)

            if importdata is not None:
                species_edited = True
                setattr(species, modelkey, importdata)

        if species_edited:
            species.save()

        resource = data[fields.species.RESOURCE]

        species.resource.clear()
        species.resource.add(resource)

        species.save()
        resource.save()

        self.species = species
        self.status = TreeImportRow.SUCCESS
        self.save()

        return True
开发者ID:OpenTreeMap,项目名称:otm-legacy,代码行数:54,代码来源:models.py

示例3: test_faulty_data1

# 需要导入模块: from treemap.models import Species [as 别名]
# 或者: from treemap.models.Species import save [as 别名]
    def test_faulty_data1(self):
        s1_g = Species(symbol='S1GSC', scientific_name='',family='',
                       genus='g1', species='', cultivar_name='',
                       v_max_dbh=50.0, v_max_height=100.0)
        s1_g.save()

        csv = """
        | point x | point y | diameter | read only | condition | genus | tree height |
        | -34.2   | 24.2    | q12      | true      | Dead      |       |         |
        | 323     | 23.2    | 14       | falseo    | Critical  |       |         |
        | 32.1    | 22.4    | 15       | true      | Dead      |       |         |
        | 33.2    | 19.1    | 32       | true      | Arg       |       |         |
        | 33.2    | q19.1   | -33.3    | true      | Dead      | gfail |         |
        | 32.1    | 12.1    |          | false     | Dead      | g1    | 200     |
        | 32.1    | 12.1    | 300      | false     | Dead      | g1    |         |
        | 11.1    | 12.1    |          | false     | Dead      |       |         |
        """

        gflds = [fields.trees.POINT_X, fields.trees.POINT_Y]
        sflds = [fields.trees.GENUS, fields.trees.SPECIES, fields.trees.CULTIVAR]

        j = self.run_through_process_views(csv)
        ierrors = self.extract_errors(j)
        self.assertEqual(ierrors['0'],
                         [(errors.FLOAT_ERROR[0],
                           [fields.trees.DIAMETER], None),
                          (errors.GEOM_OUT_OF_BOUNDS[0], gflds, None)])

        self.assertEqual(ierrors['1'],
                         [(errors.BOOL_ERROR[0],
                           [fields.trees.READ_ONLY], None),
                          (errors.INVALID_GEOM[0], gflds, None)])
        self.assertNotIn('2', ierrors)
        self.assertEqual(ierrors['3'],
                         [(errors.INVALID_CHOICE[0],
                           [fields.trees.TREE_CONDITION], 'conditions')])
        self.assertEqual(ierrors['4'],
                         [(errors.POS_FLOAT_ERROR[0],
                           [fields.trees.DIAMETER], None),
                          (errors.FLOAT_ERROR[0],
                           [fields.trees.POINT_Y], None),
                          (errors.MISSING_POINTS[0], gflds, None),
                          (errors.INVALID_SPECIES[0], sflds, 'gfail')])
        self.assertEqual(ierrors['5'],
                         [(errors.SPECIES_HEIGHT_TOO_HIGH[0],
                           [fields.trees.TREE_HEIGHT], 100.0)])
        self.assertEqual(ierrors['6'],
                         [(errors.SPECIES_DBH_TOO_HIGH[0],
                           [fields.trees.DIAMETER], 50.0)])
        self.assertEqual(ierrors['7'],
                         [(errors.EXCL_ZONE[0], gflds, None)])
开发者ID:OpenTreeMap,项目名称:otm-legacy,代码行数:53,代码来源:tests.py

示例4: _process_record

# 需要导入模块: from treemap.models import Species [as 别名]
# 或者: from treemap.models.Species import save [as 别名]
    def _process_record(self, rec):
        pk = rec['pk']
        fields = rec['fields']

        fields['max_height'] = fields['v_max_height'] or 10000
        del fields['v_max_height']

        fields['max_dbh'] = fields['v_max_dbh'] or 10000
        del fields['v_max_dbh']

        removed_fields = ['alternate_symbol', 'v_multiple_trunks',
                          'tree_count', 'resource', 'itree_code']

        for f in removed_fields:
            del fields[f]

        s = Species(**fields)
        s.pk = pk

        s.save()
开发者ID:balexandrowicz,项目名称:OTM2,代码行数:22,代码来源:load_species.py

示例5: test_species_matching

# 需要导入模块: from treemap.models import Species [as 别名]
# 或者: from treemap.models.Species import save [as 别名]
    def test_species_matching(self):
        csv = """
        | genus   | species    | common name | i-tree code  | usda symbol | alternative symbol | other part of scientific name |
        | testus1 | specieius1 | g1 s2 wowza | BDL_OTHER    |             |     |      |
        | genus   | blah       | common name | BDL_OTHER    | s1          |     |      |
        | testus1 | specieius1 | g1 s2 wowza | BDL_OTHER    | s2          |     |      |
        | testus2 | specieius2 | g1 s2 wowza | BDL_OTHER    | s1          | a3  |      |
        | genusN  | speciesN   | gN sN wowza | BDL_OTHER    |             |     | var3 |
        """

        j = self.run_through_process_views(csv)
        ierrors = self.extract_errors(j)

        # Errors for multiple species matches
        self.assertEqual(len(ierrors), 4)

        ie = SpeciesImportEvent.objects.get(pk=j['pk'])
        s1,s2,s3 = [s.pk for s in Species.objects.all()]

        s4s = Species(symbol='gnsn', scientific_name='',family='',
                      genus='genusN', species='speciesN', cultivar_name='',
                      other_part_of_name='var3', v_max_dbh=50.0, v_max_height=100.0)
        s4s.save()
        s4 = s4s.pk

        rows = ie.rows()
        matches = []
        for row in rows:
            row.validate_row()
            matches.append(row.cleaned[fields.species.ORIG_SPECIES])

        m1,m2,m3,m4,m5 = matches

        self.assertEqual(m1, {s1})
        self.assertEqual(m2, {s1})
        self.assertEqual(m3, {s1,s2})
        self.assertEqual(m4, {s1,s2,s3})
        self.assertEqual(m5, {s4})
开发者ID:OpenTreeMap,项目名称:otm-legacy,代码行数:40,代码来源:tests.py

示例6: test_species_dbh_and_height

# 需要导入模块: from treemap.models import Species [as 别名]
# 或者: from treemap.models.Species import save [as 别名]
    def test_species_dbh_and_height(self):
        s1_gsc = Species(symbol='S1G__', scientific_name='',family='',
                         genus='g1', species='s1', cultivar_name='c1',
                         v_max_height=30, v_max_dbh=19)
        s1_gs = Species(symbol='S1GS_', scientific_name='',family='',
                        genus='g1', species='s1', cultivar_name='',
                        v_max_height=22, v_max_dbh=12)
        s1_gsc.save()
        s1_gs.save()

        row = {'point x': '16',
               'point y': '20',
               'genus': 'g1',
               'species': 's1',
               'diameter': '15',
               'tree height': '18'}

        i = self.mkrow(row)
        r = i.validate_row()

        self.assertHasError(i, errors.SPECIES_DBH_TOO_HIGH)
        self.assertNotHasError(i, errors.SPECIES_HEIGHT_TOO_HIGH)

        row['tree height'] = 25
        i = self.mkrow(row)
        r = i.validate_row()

        self.assertHasError(i, errors.SPECIES_DBH_TOO_HIGH)
        self.assertHasError(i, errors.SPECIES_HEIGHT_TOO_HIGH)

        row['cultivar'] = 'c1'
        i = self.mkrow(row)
        r = i.validate_row()

        self.assertNotHasError(i, errors.SPECIES_DBH_TOO_HIGH)
        self.assertNotHasError(i, errors.SPECIES_HEIGHT_TOO_HIGH)
开发者ID:OpenTreeMap,项目名称:otm-legacy,代码行数:38,代码来源:tests.py

示例7: test_all_tree_data

# 需要导入模块: from treemap.models import Species [as 别名]
# 或者: from treemap.models.Species import save [as 别名]
    def test_all_tree_data(self):
        s1_gsc = Species(symbol='S1G__', scientific_name='',family='',
                         genus='g1', species='s1', cultivar_name='c1')
        s1_gsc.save()

        csv = """
        | point x | point y | tree owner | tree steward | diameter | tree height |
        | 45.53   | 31.1    | jimmy      | jane         | 23.1     | 90.1        |
        """

        ieid = self.run_through_commit_views(csv)
        ie = TreeImportEvent.objects.get(pk=ieid)
        tree = ie.treeimportrow_set.all()[0].plot.current_tree()

        self.assertEqual(tree.tree_owner, 'jimmy')
        self.assertEqual(tree.steward_name, 'jane')
        self.assertEqual(tree.dbh, 23.1)
        self.assertEqual(tree.height, 90.1)

        csv = """
        | point x | point y | canopy height | genus | species | cultivar |
        | 45.59   | 31.1    | 112           |       |         |          |
        | 45.58   | 33.9    |               | g1    | s1      | c1       |
        """

        ieid = self.run_through_commit_views(csv)
        ie = TreeImportEvent.objects.get(pk=ieid)
        rows = ie.treeimportrow_set.order_by('idx').all()
        tree1 = rows[0].plot.current_tree()
        tree2 = rows[1].plot.current_tree()

        self.assertEqual(tree1.canopy_height, 112)
        self.assertIsNone(tree1.species)

        self.assertEqual(tree2.species.pk, s1_gsc.pk)

        csv = """
        | point x | point y | tree sponsor | date planted | read only | tree url    |
        | 45.12   | 55.12   | treeluvr     | 2012-02-03   | true      | http://spam |
        """

        ieid = self.run_through_commit_views(csv)
        ie = TreeImportEvent.objects.get(pk=ieid)
        tree = ie.treeimportrow_set.all()[0].plot.current_tree()

        dateplanted = date(2012,2,3)

        self.assertEqual(tree.sponsor, 'treeluvr')
        self.assertEqual(tree.date_planted, dateplanted)
        self.assertEqual(tree.readonly, True)
        self.assertEqual(tree.url, 'http://spam')

        csv = """
        | point x | point y | condition | canopy condition | pests and diseases | local projects |
        | 45.66   | 53.13   | Dead      | %s               | %s                 | %s             |
        """ % ('Full - No Gaps', 'Phytophthora alni', 'San Francisco Landmark')


        ieid = self.run_through_commit_views(csv)
        ie = TreeImportEvent.objects.get(pk=ieid)
        tree = ie.treeimportrow_set.all()[0].plot.current_tree()

        self.assertEqual(tree.condition, '1')
        self.assertEqual(tree.canopy_condition, '1')
        self.assertEqual(tree.pests, '9')
开发者ID:OpenTreeMap,项目名称:otm-legacy,代码行数:67,代码来源:tests.py

示例8: setupTreemapEnv

# 需要导入模块: from treemap.models import Species [as 别名]
# 或者: from treemap.models.Species import save [as 别名]
def setupTreemapEnv():
    settings.GEOSERVER_GEO_LAYER = ""
    settings.GEOSERVER_GEO_STYLE = ""
    settings.GEOSERVER_URL = ""

    r1 = ReputationAction(name="edit verified", description="blah")
    r2 = ReputationAction(name="edit tree", description="blah")
    r3 = ReputationAction(name="Administrative Action", description="blah")
    r4 = ReputationAction(name="add tree", description="blah")
    r5 = ReputationAction(name="edit plot", description="blah")
    r6 = ReputationAction(name="add plot", description="blah")

    for r in [r1, r2, r3, r4, r5, r6]:
        r.save()

    bv = BenefitValues(
        co2=0.02,
        pm10=9.41,
        area="InlandValleys",
        electricity=0.1166,
        voc=4.69,
        ozone=5.0032,
        natural_gas=1.25278,
        nox=12.79,
        stormwater=0.0078,
        sox=3.72,
        bvoc=4.96)

    bv.save()

    dbh = "[1.0, 2.0, 3.0]"

    rsrc = Resource(
        meta_species="BDM_OTHER",
        electricity_dbh=dbh,
        co2_avoided_dbh=dbh,
        aq_pm10_dep_dbh=dbh,
        region="Sim City",
        aq_voc_avoided_dbh=dbh,
        aq_pm10_avoided_dbh=dbh,
        aq_ozone_dep_dbh=dbh,
        aq_nox_avoided_dbh=dbh,
        co2_storage_dbh=dbh,
        aq_sox_avoided_dbh=dbh,
        aq_sox_dep_dbh=dbh,
        bvoc_dbh=dbh,
        co2_sequestered_dbh=dbh,
        aq_nox_dep_dbh=dbh,
        hydro_interception_dbh=dbh,
        natural_gas_dbh=dbh)
    rsrc.save()

    u = User.objects.filter(username="jim")

    if u:
        u = u[0]
    else:
        u = User.objects.create_user("jim", "[email protected]", "jim")
        u.is_staff = True
        u.is_superuser = True
        u.save()
        up = UserProfile(user=u)
        up.save()
        u.reputation = Reputation(user=u)
        u.reputation.save()

    amy_filter_result = User.objects.filter(username="amy")
    if not amy_filter_result:
        amy = User.objects.create_user("amy", "[email protected]", "amy")
    else:
        amy = amy_filter_result[0]
    amy.is_staff = False
    amy.is_superuser = False
    amy.save()
    amy_profile = UserProfile(user=amy)
    amy_profile.save()
    amy.reputation = Reputation(user=amy)
    amy.reputation.save()

    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 = Neighborhood(
        name="n1",
        region_id=2,
        city="c1",
        state="PA",
        county="PAC",
        geometry=n1geom)
    n2 = Neighborhood(
        name="n2",
        region_id=2,
        city="c2",
        state="NY",
        county="NYC",
        geometry=n2geom)

    n1.save()
#.........这里部分代码省略.........
开发者ID:nittt3,项目名称:Code,代码行数:103,代码来源:test_utils.py

示例9: setUp

# 需要导入模块: from treemap.models import Species [as 别名]
# 或者: from treemap.models.Species import save [as 别名]
    def setUp(self):
        ######
        # Request/Render mock
        ######
        def local_render_to_response(*args, **kwargs):
            from django.template import loader, RequestContext
            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
    
        ######
        # Content types
        ######
        r1 = ReputationAction(name="edit verified", description="blah")
        r2 = ReputationAction(name="edit tree", description="blah")
        r3 = ReputationAction(name="Administrative Action", description="blah")
        r4 = ReputationAction(name="add tree", description="blah")
        r5 = ReputationAction(name="edit plot", description="blah")
        r6 = ReputationAction(name="add plot", description="blah")
        r7 = ReputationAction(name="add stewardship", description="blah")
        r8 = ReputationAction(name="remove stewardship", description="blah")

        self.ra = [r1,r2,r3,r4,r5,r6,r7,r8]

        for r in self.ra:
            r.save()

        ######
        # Set up benefit values
        ######
        bv = BenefitValues(co2=0.02, pm10=9.41, area="InlandValleys",
                           electricity=0.1166,voc=4.69,ozone=5.0032,natural_gas=1.25278,
                           nox=12.79,stormwater=0.0078,sox=3.72,bvoc=4.96)

        bv.save()
        self.bv = bv


        dbh = "[1.0, 2.0, 3.0]"

        rsrc = Resource(meta_species="BDM_OTHER", electricity_dbh=dbh, co2_avoided_dbh=dbh,
                        aq_pm10_dep_dbh=dbh, region="Sim City", aq_voc_avoided_dbh=dbh,
                        aq_pm10_avoided_dbh=dbh, aq_ozone_dep_dbh=dbh, aq_nox_avoided_dbh=dbh,
                        co2_storage_dbh=dbh,aq_sox_avoided_dbh=dbh, aq_sox_dep_dbh=dbh,
                        bvoc_dbh=dbh, co2_sequestered_dbh=dbh, aq_nox_dep_dbh=dbh,
                        hydro_interception_dbh=dbh, natural_gas_dbh=dbh)
        rsrc.save()
        self.rsrc = rsrc

        ######
        # Users
        ######
        u = User.objects.filter(username="jim")
            
        if u:
            u = u[0]
        else:
            u = User.objects.create_user("jim","[email protected]","jim")
            u.is_staff = True
            u.is_superuser = True
            u.save()
            up = UserProfile(user=u)
            u.reputation = Reputation(user=u)
            u.reputation.save()

        self.u = u
        

        #######
        # Setup geometries -> Two stacked 100x100 squares
        #######
        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 = Neighborhood(name="n1", region_id=2, city="c1", state="PA", county="PAC", geometry=n1geom)
        n2 = Neighborhood(name="n2", region_id=2, city="c2", state="NY", county="NYC", geometry=n2geom)

        n1.save()
        n2.save()

        z1geom = MultiPolygon(Polygon(((0,0),(100,0),(100,100),(0,100),(0,0))))
        z2geom = MultiPolygon(Polygon(((0,100),(100,100),(100,200),(0,200),(0,100))))

        z1 = ZipCode(zip="19107",geometry=z1geom)
        z2 = ZipCode(zip="10001",geometry=z2geom)

        z1.save()
        z2.save()

        exgeom1 = MultiPolygon(Polygon(((0,0),(25,0),(25,25),(0,25),(0,0))))
        ex1 = ExclusionMask(geometry=exgeom1, type="building")
#.........这里部分代码省略.........
开发者ID:KetanPandhi,项目名称:OpenTreeMap,代码行数:103,代码来源:tests.py

示例10: setupTreemapEnv

# 需要导入模块: from treemap.models import Species [as 别名]
# 或者: from treemap.models.Species import save [as 别名]
def setupTreemapEnv():
    settings.GEOSERVER_GEO_LAYER = ""
    settings.GEOSERVER_GEO_STYLE = ""
    settings.GEOSERVER_URL = ""

    def local_render_to_response(*args, **kwargs):
        from django.template import loader, RequestContext
        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

    r1 = ReputationAction(name="edit verified", description="blah")
    r2 = ReputationAction(name="edit tree", description="blah")
    r3 = ReputationAction(name="Administrative Action", description="blah")
    r4 = ReputationAction(name="add tree", description="blah")
    r5 = ReputationAction(name="edit plot", description="blah")
    r6 = ReputationAction(name="add plot", description="blah")
    r7 = ReputationAction(name="add stewardship", description="blah")
    r8 = ReputationAction(name="remove stewardship", description="blah")

    for r in [r1, r2, r3, r4, r5, r6, r7, r8]:
        r.save()

    bv = BenefitValues(
        co2=0.02,
        pm10=9.41,
        area="InlandValleys",
        electricity=0.1166,
        voc=4.69,
        ozone=5.0032,
        natural_gas=1.25278,
        nox=12.79,
        stormwater=0.0078,
        sox=3.72,
        bvoc=4.96,
    )

    bv.save()

    dbh = "[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0]"
    dbh2 = "[2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]"

    rsrc1 = Resource(meta_species="BDM OTHER", region="NoEastXXX")
    rsrc2 = Resource(meta_species="BDL OTHER", region="NoEastXXX")

    rsrc1.save()
    rsrc2.save()

    u = User.objects.filter(username="jim")

    if u:
        u = u[0]
    else:
        u = User.objects.create_user("jim", "[email protected]", "jim")
        u.is_staff = True
        u.is_superuser = True
        u.save()
        up = UserProfile(user=u)
        up.save()
        u.reputation = Reputation(user=u)
        u.reputation.save()

    amy_filter_result = User.objects.filter(username="amy")
    if not amy_filter_result:
        amy = User.objects.create_user("amy", "[email protected]", "amy")
    else:
        amy = amy_filter_result[0]
        amy.is_staff = False
        amy.is_superuser = False
        amy.save()
        amy_profile = UserProfile(user=amy)
        amy_profile.save()
        amy.reputation = Reputation(user=amy)
        amy.reputation.save()

    olivia_filter_result = User.objects.filter(username="olivia")
    if not amy_filter_result:
        olivia = User.objects.create_user("olivia", "[email protected]", "olivia")
    else:
        olivia = olivia_filter_result[0]
        olivia.is_staff = False
        olivia.is_superuser = False
        olivia.save()
        olivia_profile = UserProfile(user=olivia)
        olivia_profile.save()
        olivia.reputation = Reputation(user=olivia)
        olivia.reputation.save()

    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 = Neighborhood(name="n1", region_id=2, city="c1", state="PA", county="PAC", geometry=n1geom)
#.........这里部分代码省略.........
开发者ID:OpenTreeMap,项目名称:otm-legacy,代码行数:103,代码来源:test_utils.py


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