Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ohmg/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class LayerSetAdmin(admin.ModelAdmin):
"layer_display_list",
"extent",
"multimask_extent",
"multimask",
)
search_fields = ("map__title",)
list_filter = ("category",)
Expand Down
32 changes: 1 addition & 31 deletions ohmg/core/management/commands/checkdb.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import copy

from django.core.management.base import BaseCommand
from django.db.models import Q

from ohmg.core.models import Document, Layer, LayerSet
from ohmg.core.models import Document
from ohmg.core.utils.cli import confirm_continue
from ohmg.georeference.models import GeorefSession, PrepSession, SessionLock

Expand Down Expand Up @@ -62,34 +60,6 @@ def fix_layer_slug(slug, valid_slugs):
else:
return None

if options["operation"] == "multimasks":
valid_slugs = list(Layer.objects.all().values_list("slug", flat=True))
layersets = LayerSet.objects.exclude(multimask=None).order_by("map_id")
to_save = set()
errors = []
for ls in layersets:
new_mm = copy.deepcopy(ls.multimask)
for k, v in ls.multimask.items():
newslug = fix_layer_slug(k, valid_slugs)
if not newslug:
errors.append(f"ERROR: {k}")
elif newslug != k:
print(f"{k} -> {newslug}")
new_mm[newslug] = new_mm.pop(k)
new_mm[newslug]["properties"] = {"layer": newslug}
to_save.add(ls)
ls.multimask = new_mm

for e in errors:
print(e)
print(f"{len(errors)} layer slugs have errors")

print(f"{len(to_save)} multimasks to fix")
if options["fix"]:
for ls in to_save:
print(f"saving {ls}")
ls.save()

if options["operation"] == "sessions":
print("\nchecking PrepSessions...")
s = PrepSession.objects.filter(doc2__isnull=True)
Expand Down
17 changes: 17 additions & 0 deletions ohmg/core/migrations/0010_remove_layerset_multimask.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.27 on 2026-04-15 20:33

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('core', '0009_layer_mask'),
]

operations = [
migrations.RemoveField(
model_name='layerset',
name='multimask',
),
]
1 change: 0 additions & 1 deletion ohmg/core/models/layerset.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class Meta:
blank=True,
null=True,
)
multimask = models.JSONField(null=True, blank=True)
mosaic_geotiff = models.FileField(
upload_to="mosaics",
null=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"fields": {
"map": "sanborn03375_001",
"category": 1,
"multimask": null,
"mosaic_geotiff": "",
"mosaic_json": "",
"extent": "[\"-91.82785034179688\", \"29.998949050206093\", \"-91.81137084960938\", \"30.015598098308676\"]"
Expand Down