From 9b8eba8b96c5ca6af88add2ebd7ab8050334ca53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Cant=C3=B9?= Date: Wed, 15 May 2024 12:48:22 +0200 Subject: [PATCH] move attribution to source --- ...emove_rastersource_attribution_and_more.py | 25 +++++++++++++++++++ metadata_catalogue/maps/models.py | 3 +-- 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 metadata_catalogue/maps/migrations/0017_remove_rastersource_attribution_and_more.py diff --git a/metadata_catalogue/maps/migrations/0017_remove_rastersource_attribution_and_more.py b/metadata_catalogue/maps/migrations/0017_remove_rastersource_attribution_and_more.py new file mode 100644 index 0000000..29f9152 --- /dev/null +++ b/metadata_catalogue/maps/migrations/0017_remove_rastersource_attribution_and_more.py @@ -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), + ), + ] diff --git a/metadata_catalogue/maps/models.py b/metadata_catalogue/maps/models.py index 93d6812..33250bc 100644 --- a/metadata_catalogue/maps/models.py +++ b/metadata_catalogue/maps/models.py @@ -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: @@ -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 @@ -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)