feat: Add species specialization and parent option to Rescue Orgs
This commit is contained in:
		@@ -67,5 +67,6 @@ Healthchecks
 | 
			
		||||
You can configure notfellchen to give a hourly ping to a healthchecks server. If this ping is not received, you will get notified and cna check why the celery jobs are no running.
 | 
			
		||||
Add the following to your `notfellchen.cfg` and adjust the URL to match your check.
 | 
			
		||||
.. code::
 | 
			
		||||
 | 
			
		||||
  [monitoring]
 | 
			
		||||
  healthchecks_url=https://health.example.org/ping/5fa7c9b2-753a-4cb3-bcc9-f982f5bc68e8
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,27 @@
 | 
			
		||||
# Generated by Django 5.2.1 on 2025-07-03 09:28
 | 
			
		||||
 | 
			
		||||
import django.db.models.deletion
 | 
			
		||||
from django.db import migrations, models
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Migration(migrations.Migration):
 | 
			
		||||
 | 
			
		||||
    dependencies = [
 | 
			
		||||
        ('fellchensammlung', '0050_rename_rescues_organization_speciesspecificurl_rescue_organization'),
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    operations = [
 | 
			
		||||
        migrations.AddField(
 | 
			
		||||
            model_name='rescueorganization',
 | 
			
		||||
            name='parent_org',
 | 
			
		||||
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='fellchensammlung.rescueorganization'),
 | 
			
		||||
        ),
 | 
			
		||||
        migrations.CreateModel(
 | 
			
		||||
            name='SpeciesSpecialization',
 | 
			
		||||
            fields=[
 | 
			
		||||
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
 | 
			
		||||
                ('rescue_organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='fellchensammlung.rescueorganization', verbose_name='Tierschutzorganisation')),
 | 
			
		||||
                ('species', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='fellchensammlung.species', verbose_name='Tierart')),
 | 
			
		||||
            ],
 | 
			
		||||
        ),
 | 
			
		||||
    ]
 | 
			
		||||
@@ -68,7 +68,6 @@ class Location(models.Model):
 | 
			
		||||
    def position(self):
 | 
			
		||||
        return (self.latitude, self.longitude)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @staticmethod
 | 
			
		||||
    def get_location_from_string(location_string):
 | 
			
		||||
        try:
 | 
			
		||||
@@ -150,6 +149,7 @@ class RescueOrganization(models.Model):
 | 
			
		||||
    exclude_from_check = models.BooleanField(default=False, verbose_name=_('Von Prüfung ausschließen'),
 | 
			
		||||
                                             help_text=_("Organisation von der manuellen Überprüfung ausschließen, "
 | 
			
		||||
                                                         "z.B. weil Tiere nicht online geführt werden"))
 | 
			
		||||
    parent_org = models.ForeignKey("RescueOrganization", on_delete=models.PROTECT, blank=True, null=True)
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        unique_together = ('external_object_identifier', 'external_source_identifier',)
 | 
			
		||||
@@ -990,3 +990,15 @@ class SpeciesSpecificURL(models.Model):
 | 
			
		||||
    rescue_organization = models.ForeignKey(RescueOrganization, on_delete=models.CASCADE,
 | 
			
		||||
                                            verbose_name=_("Tierschutzorganisation"))
 | 
			
		||||
    url = models.URLField(verbose_name=_("Tierartspezifische URL"))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class SpeciesSpecialization(models.Model):
 | 
			
		||||
    """
 | 
			
		||||
    Model that allows to specify if a rescue organization has a specialization for dedicated species
 | 
			
		||||
    """
 | 
			
		||||
    species = models.ForeignKey(Species, on_delete=models.CASCADE, verbose_name=_("Tierart"))
 | 
			
		||||
    rescue_organization = models.ForeignKey(RescueOrganization, on_delete=models.CASCADE,
 | 
			
		||||
                                            verbose_name=_("Tierschutzorganisation"))
 | 
			
		||||
 | 
			
		||||
    def ___str__(self):
 | 
			
		||||
        return f"[{self.rescue_organization}] - {self.species}"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user