feat: Add external source and object identifier

This commit is contained in:
moanos [he/him] 2025-01-05 19:20:05 +01:00
parent 002dded0d5
commit 81cc5cd53d
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,23 @@
# Generated by Django 5.1.4 on 2025-01-05 18:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fellchensammlung', '0032_searchsubscription_created_at_and_more'),
]
operations = [
migrations.AddField(
model_name='rescueorganization',
name='external_object_identifier',
field=models.CharField(blank=True, max_length=200, null=True, verbose_name='External Object Identifier'),
),
migrations.AddField(
model_name='rescueorganization',
name='external_source_identifier',
field=models.CharField(blank=True, choices=[('OSM', 'Open Street Map')], max_length=200, null=True, verbose_name='External Source Identifier'),
),
]

View File

@ -1,4 +1,5 @@
import uuid
from random import choices
from django.db import models
from django.urls import reverse
@ -81,6 +82,8 @@ class Location(models.Model):
instance.location = location
instance.save()
class ExternalSourceChoices(models.TextChoices):
OSM = "OSM", _("Open Street Map")
class RescueOrganization(models.Model):
def __str__(self):
@ -118,6 +121,10 @@ class RescueOrganization(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
internal_comment = models.TextField(verbose_name=_("Interner Kommentar"), null=True, blank=True, )
description = models.TextField(null=True, blank=True, verbose_name=_('Beschreibung')) # Markdown allowed
external_object_identifier = models.CharField(max_length=200, null=True, blank=True, verbose_name=_('External Object Identifier'))
external_source_identifier = models.CharField(max_length=200, null=True, blank=True,
choices=ExternalSourceChoices.choices,
verbose_name=_('External Source Identifier'))
def get_absolute_url(self):
return reverse("rescue-organization-detail", args=[str(self.pk)])