-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #130 from Terralego/support_python_3.12
Support Django 5.0 & Python 3.12
- Loading branch information
Showing
10 changed files
with
343 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,29 @@ | ||
from enum import IntEnum | ||
from django.db.models import IntegerChoices | ||
|
||
default_app_config = 'geostore.apps.GeostoreConfig' | ||
|
||
|
||
class GeometryTypes(IntEnum): | ||
Point = 0 | ||
LineString = 1 | ||
class GeometryTypes(IntegerChoices): | ||
Point = 0, 'Point' | ||
LineString = 1, 'LineString' | ||
# LinearRing 2 | ||
Polygon = 3 | ||
MultiPoint = 4 | ||
MultiLineString = 5 | ||
MultiPolygon = 6 | ||
GeometryCollection = 7 | ||
|
||
@classmethod | ||
def choices(cls): | ||
return [(geom_type.value, str(geom_type).split('.')[-1]) for geom_type in cls] | ||
Polygon = 3, 'Polygon' | ||
MultiPoint = 4, 'MultiPoint' | ||
MultiLineString = 5, 'MultiLineString' | ||
MultiPolygon = 6, 'MultiPolygon' | ||
GeometryCollection = 7, 'GeometryCollection' | ||
|
||
@classmethod | ||
def shape_allowed_types(cls): | ||
""" | ||
Types allowed in shapefile export | ||
""" | ||
excluded = [GeometryTypes.GeometryCollection] | ||
return [geom_type for geom_type in cls if geom_type not in excluded] | ||
return [cls.Point, cls.LineString, cls.Polygon, cls.MultiPoint, | ||
cls.MultiLineString, cls.MultiPolygon] | ||
|
||
@classmethod | ||
def shape_allowed_type_names(cls): | ||
""" | ||
Name types allowed in shapefile export | ||
""" | ||
return [str(geom_type).split('.')[-1] for geom_type in cls.shape_allowed_types()] | ||
return [geom_type.label for geom_type in cls.shape_allowed_types()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
geostore/migrations/0048_remove_feature_geostore_fe_layer_i_c3168f_gist_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Generated by Django 5.0.1 on 2024-01-12 11:26 | ||
|
||
import django.contrib.postgres.indexes | ||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('geostore', '0047_alter_feature_properties'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveIndex( | ||
model_name='feature', | ||
name='geostore_fe_layer_i_c3168f_gist', | ||
), | ||
migrations.RemoveIndex( | ||
model_name='featureextrageom', | ||
name='feg_geom_gist_index', | ||
), | ||
migrations.AddIndex( | ||
model_name='feature', | ||
index=django.contrib.postgres.indexes.GistIndex(fields=['geom'], name='geostore_fe_geom_cff9a1_gist'), | ||
), | ||
migrations.AddIndex( | ||
model_name='featureextrageom', | ||
index=django.contrib.postgres.indexes.GistIndex(fields=['geom'], name='feg_geom_gist_index'), | ||
), | ||
] |
Oops, something went wrong.