feat: Add species specific URL to allow faster checking if new animals exist in this rescue org
This commit is contained in:
parent
4ef9da953c
commit
fb9c78d96a
@ -6,7 +6,8 @@ from django.utils.html import format_html
|
|||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.http import urlencode
|
from django.utils.http import urlencode
|
||||||
|
|
||||||
from .models import User, Language, Text, ReportComment, ReportAdoptionNotice, Log, Timestamp, SearchSubscription
|
from .models import User, Language, Text, ReportComment, ReportAdoptionNotice, Log, Timestamp, SearchSubscription, \
|
||||||
|
SpeciesSpecificURL
|
||||||
|
|
||||||
from .models import Animal, Species, RescueOrganization, AdoptionNotice, Location, Rule, Image, ModerationAction, \
|
from .models import Animal, Species, RescueOrganization, AdoptionNotice, Location, Rule, Image, ModerationAction, \
|
||||||
Comment, Report, Announcement, AdoptionNoticeStatus, User, Subscriptions, BaseNotification
|
Comment, Report, Announcement, AdoptionNoticeStatus, User, Subscriptions, BaseNotification
|
||||||
@ -93,6 +94,8 @@ class ReportAdoptionNoticeAdmin(admin.ModelAdmin):
|
|||||||
|
|
||||||
reported_content_link.short_description = "Reported Content"
|
reported_content_link.short_description = "Reported Content"
|
||||||
|
|
||||||
|
class SpeciesSpecificURLInline(admin.StackedInline):
|
||||||
|
model = SpeciesSpecificURL
|
||||||
|
|
||||||
@admin.register(RescueOrganization)
|
@admin.register(RescueOrganization)
|
||||||
class RescueOrganizationAdmin(admin.ModelAdmin):
|
class RescueOrganizationAdmin(admin.ModelAdmin):
|
||||||
@ -100,6 +103,10 @@ class RescueOrganizationAdmin(admin.ModelAdmin):
|
|||||||
list_display = ("name", "trusted", "allows_using_materials", "website")
|
list_display = ("name", "trusted", "allows_using_materials", "website")
|
||||||
list_filter = ("allows_using_materials", "trusted",)
|
list_filter = ("allows_using_materials", "trusted",)
|
||||||
|
|
||||||
|
inlines = [
|
||||||
|
SpeciesSpecificURLInline,
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Text)
|
@admin.register(Text)
|
||||||
class TextAdmin(admin.ModelAdmin):
|
class TextAdmin(admin.ModelAdmin):
|
||||||
|
23
src/fellchensammlung/migrations/0034_speciesspecificurl.py
Normal file
23
src/fellchensammlung/migrations/0034_speciesspecificurl.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Generated by Django 5.1.4 on 2025-01-05 19:36
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('fellchensammlung', '0033_rescueorganization_external_object_identifier_and_more'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='SpeciesSpecificURL',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('url', models.URLField(verbose_name='Tierartspezifische URL')),
|
||||||
|
('rescues_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')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
@ -861,3 +861,11 @@ class Timestamp(models.Model):
|
|||||||
|
|
||||||
def ___str__(self):
|
def ___str__(self):
|
||||||
return f"[{self.key}] - {self.timestamp.strftime('%H:%M:%S %d-%m-%Y ')} - {self.data}"
|
return f"[{self.key}] - {self.timestamp.strftime('%H:%M:%S %d-%m-%Y ')} - {self.data}"
|
||||||
|
|
||||||
|
class SpeciesSpecificURL(models.Model):
|
||||||
|
"""
|
||||||
|
Model that allows to specify a URL for a rescue organization where a certain species can be found
|
||||||
|
"""
|
||||||
|
species = models.ForeignKey(Species, on_delete=models.CASCADE, verbose_name=_("Tierart"))
|
||||||
|
rescues_organization = models.ForeignKey(RescueOrganization, on_delete=models.CASCADE, verbose_name=_("Tierschutzorganisation"))
|
||||||
|
url = models.URLField(verbose_name=_("Tierartspezifische URL"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user