Skip to content

Commit

Permalink
allow longer slugs
Browse files Browse the repository at this point in the history
  • Loading branch information
nicokant committed Dec 19, 2023
1 parent 64fb981 commit 2f81d1b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 4.2.8 on 2023-12-19 10:46

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("maps", "0002_alter_layer_group"),
]

operations = [
migrations.AlterField(
model_name="layer",
name="slug",
field=models.SlugField(blank=True, max_length=250, null=True),
),
migrations.AlterField(
model_name="map",
name="slug",
field=models.SlugField(max_length=150),
),
migrations.AlterField(
model_name="source",
name="slug",
field=models.SlugField(blank=True, max_length=250, null=True),
),
]
8 changes: 4 additions & 4 deletions metadata_catalogue/maps/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def empty_json():

class Source(PolymorphicModel):
name = models.CharField(max_length=250)
slug = models.SlugField(null=True, blank=True)
slug = models.SlugField(null=True, blank=True, max_length=250)
extra = models.JSONField(default=empty_json, blank=True)
owner = models.ForeignKey("users.User", on_delete=models.SET_NULL, null=True, blank=True)
style = models.JSONField(default=empty_json, blank=True)
Expand Down Expand Up @@ -89,7 +89,7 @@ def type(self):

class Layer(models.Model):
name = models.CharField(max_length=250, null=True, blank=True)
slug = models.SlugField(null=True, blank=True)
slug = models.SlugField(null=True, blank=True, max_length=250)
map = models.ForeignKey("maps.Map", on_delete=models.CASCADE, related_name="layers")
source = models.ForeignKey("maps.Source", on_delete=models.CASCADE, null=True, blank=True)
source_layer = models.CharField(blank=True, null=True)
Expand Down Expand Up @@ -131,7 +131,7 @@ class Meta:

class Map(models.Model):
title = models.CharField(max_length=150)
slug = models.SlugField()
slug = models.SlugField(max_length=150)
subtitle = models.CharField(max_length=250, null=True, blank=True)
description = models.TextField(blank=True)
# center =
Expand All @@ -152,7 +152,7 @@ class Meta:

def get_metadata(self, request):
layers = []
for root in self.groups.order_by("-order").all():
for root in self.groups.order_by("order").all():
layers.append(root.as_layer_tree())

style_url = request.build_absolute_uri(
Expand Down

0 comments on commit 2f81d1b

Please sign in to comment.