docs: label

This commit is contained in:
moanos [he/him] 2025-01-09 06:07:54 +01:00
parent 6229f0f8a2
commit 3b37b5f588

View File

@ -39,7 +39,7 @@ class Language(models.Model):
class Location(models.Model): class Location(models.Model):
place_id = models.IntegerField() place_id = models.IntegerField() # OSM id
latitude = models.FloatField() latitude = models.FloatField()
longitude = models.FloatField() longitude = models.FloatField()
name = models.CharField(max_length=2000) name = models.CharField(max_length=2000)
@ -83,9 +83,11 @@ class Location(models.Model):
instance.location = location instance.location = location
instance.save() instance.save()
class ExternalSourceChoices(models.TextChoices): class ExternalSourceChoices(models.TextChoices):
OSM = "OSM", _("Open Street Map") OSM = "OSM", _("Open Street Map")
class RescueOrganization(models.Model): class RescueOrganization(models.Model):
def __str__(self): def __str__(self):
return f"{self.name}" return f"{self.name}"
@ -122,7 +124,8 @@ class RescueOrganization(models.Model):
created_at = models.DateTimeField(auto_now_add=True) created_at = models.DateTimeField(auto_now_add=True)
internal_comment = models.TextField(verbose_name=_("Interner Kommentar"), null=True, blank=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 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_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, external_source_identifier = models.CharField(max_length=200, null=True, blank=True,
choices=ExternalSourceChoices.choices, choices=ExternalSourceChoices.choices,
verbose_name=_('External Source Identifier')) verbose_name=_('External Source Identifier'))
@ -140,6 +143,7 @@ class RescueOrganization(models.Model):
return Position(latitude=self.location.latitude, longitude=self.location.longitude) return Position(latitude=self.location.latitude, longitude=self.location.longitude)
else: else:
return None return None
@property @property
def description_short(self): def description_short(self):
if self.description is None: if self.description is None:
@ -148,7 +152,6 @@ class RescueOrganization(models.Model):
return self.description[:200] + f" ... [weiterlesen]({self.get_absolute_url()})" return self.description[:200] + f" ... [weiterlesen]({self.get_absolute_url()})"
# Admins can perform all actions and have the highest trust associated with them # Admins can perform all actions and have the highest trust associated with them
# Moderators can make moderation decisions regarding the deletion of content # Moderators can make moderation decisions regarding the deletion of content
# Coordinators can create adoption notices without them being checked # Coordinators can create adoption notices without them being checked
@ -285,7 +288,6 @@ class AdoptionNotice(models.Model):
time_since_last_checked = timezone.now() - self.last_checked time_since_last_checked = timezone.now() - self.last_checked
return time_since_as_hr_string(time_since_last_checked) return time_since_as_hr_string(time_since_last_checked)
def sex_code(self): def sex_code(self):
# Treat Intersex as mixed in order to increase their visibility # Treat Intersex as mixed in order to increase their visibility
if len(self.sexes) > 1: if len(self.sexes) > 1:
@ -578,6 +580,7 @@ class Animal(models.Model):
"""Returns the url to access a detailed page for the animal.""" """Returns the url to access a detailed page for the animal."""
return reverse('animal-detail', args=[str(self.id)]) return reverse('animal-detail', args=[str(self.id)])
class DistanceChoices(models.IntegerChoices): class DistanceChoices(models.IntegerChoices):
TWENTY = 20, '20 km' TWENTY = 20, '20 km'
FIFTY = 50, '50 km' FIFTY = 50, '50 km'
@ -585,6 +588,7 @@ class DistanceChoices(models.IntegerChoices):
TWO_HUNDRED = 200, '200 km' TWO_HUNDRED = 200, '200 km'
FIVE_HUNDRED = 500, '500 km' FIVE_HUNDRED = 500, '500 km'
class SearchSubscription(models.Model): class SearchSubscription(models.Model):
""" """
SearchSubscriptions allow a user to get a notification when a new AdoptionNotice is added that matches their Search SearchSubscriptions allow a user to get a notification when a new AdoptionNotice is added that matches their Search
@ -877,10 +881,12 @@ 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): class SpeciesSpecificURL(models.Model):
""" """
Model that allows to specify a URL for a rescue organization where a certain species can be found 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")) species = models.ForeignKey(Species, on_delete=models.CASCADE, verbose_name=_("Tierart"))
rescues_organization = models.ForeignKey(RescueOrganization, on_delete=models.CASCADE, verbose_name=_("Tierschutzorganisation")) rescues_organization = models.ForeignKey(RescueOrganization, on_delete=models.CASCADE,
verbose_name=_("Tierschutzorganisation"))
url = models.URLField(verbose_name=_("Tierartspezifische URL")) url = models.URLField(verbose_name=_("Tierartspezifische URL"))