Addes help_texts and translations.

This commit is contained in:
Marcus Scholz 2020-10-06 17:01:29 +02:00
parent 2e73cb92d4
commit da60d81e90
4 changed files with 32 additions and 6 deletions

View File

@ -4,8 +4,10 @@
''' (web)forms that can be used elsewhere. '''
from django import forms
from django.db import models
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from lostplaces.models import Place, PlaceImage, Voucher
class ExplorerCreationForm(UserCreationForm):
@ -14,7 +16,7 @@ class ExplorerCreationForm(UserCreationForm):
fields = ('username', 'email')
voucher = forms.CharField(
max_length=30,
help_text='The Voucher you got from an administrator'
help_text=_('The Voucher you got from an administrator')
)
def is_valid(self):

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-10-05 20:26+0200\n"
"POT-Creation-Date: 2020-10-06 16:59+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -18,6 +18,26 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: forms.py:19
msgid "The Voucher you got from an administrator"
msgstr "Der Einladungs-Code, den Dir ein Administrator gegeben hat"
#: models/abstract_models.py:32
msgid "Latitude in decimal format: e. g. 41.40338"
msgstr "Breitengrad in dezimaler Form: z. B. 51.95021"
#: models/abstract_models.py:39
msgid "Longitude in decimal format: e. g. 2.17403"
msgstr "Breitengrad in dezimaler Form: z. B. 7.4840155"
#: models/place.py:19
msgid "Location"
msgstr "Ort"
#: models/place.py:20
msgid "Description"
msgstr "Beschreibung"
#: templates/403.html:4
msgid "Forbidden"
msgstr "Nicht Erlaubt"

View File

@ -1,5 +1,6 @@
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.core.validators import MaxValueValidator, MinValueValidator
from taggit.managers import TaggableManager
@ -27,13 +28,15 @@ class Mapable(models.Model):
validators=[
MinValueValidator(-90),
MaxValueValidator(90)
]
],
help_text=_('Latitude in decimal format: e. g. 41.40338')
)
longitude = models.FloatField(
validators=[
MinValueValidator(-180),
MaxValueValidator(180)
]
],
help_text=_('Longitude in decimal format: e. g. 2.17403')
)
class Submittable(models.Model):

View File

@ -4,6 +4,7 @@ from django.db import models
from django.urls import reverse
from django.dispatch import receiver
from django.db.models.signals import post_delete, pre_save
from django.utils.translation import ugettext_lazy as _
from lostplaces.models.abstract_models import Submittable, Taggable, Mapable
@ -15,8 +16,8 @@ class Place(Submittable, Taggable, Mapable):
Place defines a lost place (location, name, description etc.).
"""
location = models.CharField(max_length=50)
description = models.TextField()
location = models.CharField(max_length=50, help_text=_('Location'))
description = models.TextField(help_text=_('Description'))
def get_absolute_url(self):
return reverse('place_detail', kwargs={'pk': self.pk})