Skip to content

Commit

Permalink
move attribution to source
Browse files Browse the repository at this point in the history
  • Loading branch information
nicokant committed May 15, 2024
1 parent d1533c0 commit 9b8eba8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 4.2.8 on 2024-05-15 10:46

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("maps", "0016_layer_metadata"),
]

operations = [
migrations.RemoveField(
model_name="rastersource",
name="attribution",
),
migrations.RemoveField(
model_name="vectorsource",
name="attribution",
),
migrations.AddField(
model_name="source",
name="attribution",
field=models.CharField(blank=True, max_length=250, null=True),
),
]
3 changes: 1 addition & 2 deletions metadata_catalogue/maps/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class Source(PolymorphicModel):
owner = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, null=True, blank=True)
style = models.JSONField(default=empty_json, blank=True)
metadata = models.JSONField(default=empty_json, blank=True)
attribution = models.CharField(null=True, blank=True, max_length=250)

def save(self, *args, **kwargs):
if self.slug is None:
Expand Down Expand Up @@ -62,7 +63,6 @@ class RasterSource(Source):
original_data = models.FileField(upload_to=layers_folder, null=True, blank=True)
protocol = models.CharField(null=True, blank=True)
url = models.URLField(null=True, blank=True)
attribution = models.CharField(null=True, blank=True, max_length=250)

def get_download_url(self, request):
return request.build_absolute_uri(self.original_data.url) if self.original_data else self.url
Expand All @@ -81,7 +81,6 @@ class VectorSource(Source):
original_data = models.FileField(upload_to=layers_folder, null=True, blank=True)
protocol = models.CharField(null=True, blank=True)
url = models.URLField(null=True, blank=True)
attribution = models.CharField(null=True, blank=True, max_length=250)

default_layer = models.CharField(null=True, blank=True)

Expand Down

0 comments on commit 9b8eba8

Please sign in to comment.