Translated model fields.

This commit is contained in:
2020-10-11 02:07:14 +02:00
parent e52c3f4d4b
commit 52f9638d74
3 changed files with 49 additions and 10 deletions

View File

@@ -23,12 +23,16 @@ class Mapable(models.Model):
class Meta:
abstract = True
name = models.CharField(max_length=50)
name = models.CharField(
max_length=50,
verbose_name=_('Name'),
)
latitude = models.FloatField(
validators=[
MinValueValidator(-90),
MaxValueValidator(90)
],
verbose_name=_('Latitude'),
help_text=_('Latitude in decimal format: e. g. 41.40338')
)
longitude = models.FloatField(
@@ -36,6 +40,7 @@ class Mapable(models.Model):
MinValueValidator(-180),
MaxValueValidator(180)
],
verbose_name=_('Longitude'),
help_text=_('Longitude in decimal format: e. g. 2.17403')
)

View File

@@ -16,8 +16,14 @@ class Place(Submittable, Taggable, Mapable):
Place defines a lost place (location, name, description etc.).
"""
location = models.CharField(max_length=50, help_text=_('Location'))
description = models.TextField(help_text=_('Description'))
location = models.CharField(
max_length=50,
verbose_name=_('Location'),
)
description = models.TextField(
help_text=_('Description of the place: e.g. how to get there, where to be careful, the place\'s history...'),
verbose_name=_('Description'),
)
def get_absolute_url(self):
return reverse('place_detail', kwargs={'pk': self.pk})
@@ -73,11 +79,15 @@ class PlaceImage (Submittable):
PlaceImage references a Place to which it belongs.
"""
description = models.TextField(blank=True)
description = models.TextField(
blank=True,
verbose_name=_('Description'),
)
filename = ThumbnailerImageField(
upload_to=generate_image_upload_path,
resize_source=dict(size=(2560, 2560),
sharpen=True),
verbose_name=_('Filename(s)'),
help_text=_('Optional: One or more images to upload')
)
place = models.ForeignKey(