# Generated by Django 3.1.3 on 2022-07-13 06:01 import django from django.db import migrations from konova.sub_settings.lanis_settings import DEFAULT_SRID_RLP def migrate_geometry_srs(apps, schema_editor): Geometry = apps.get_model("konova", "Geometry") all_geoms = Geometry.objects.all() # Transform all geoms and store in new geom field for geometry in all_geoms: geom = geometry.geom if geom is None: continue geom.transform(DEFAULT_SRID_RLP) geometry.geom_tmp = geom geometry.save() class Migration(migrations.Migration): dependencies = [ ('konova', '0011_auto_20220420_1101'), ] operations = [ migrations.AddField( model_name="geometry", name="geom_tmp", field=django.contrib.gis.db.models.fields.MultiPolygonField(blank=True, null=True, srid=DEFAULT_SRID_RLP) ), migrations.RunPython(migrate_geometry_srs), ]