Commit 55125525 authored by Matthieu Gautier's avatar Matthieu Gautier

Better form field for the birth_year.

Using the IntegerField is a bit weird for a birth date.

With the `localize=True`, django doesn't use the side arrows.
It will probably try to interpret the `.` and the `,` differently
depending of the current local, but it is not a problem for an integer.

Fix #20
parent 2b81d40f
from datetime import datetime
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
......@@ -10,12 +11,17 @@ from ideascube.widgets import LangSelect, RichTextEntry
from .models import RadioShow
current_year = datetime.now().year
class MessageForm(forms.Form):
# Translators: Do not translate this, the translation is in Ideascube
author = forms.CharField(label=_("Name"), max_length=100)
motto = forms.CharField(label=_("Motto"))
# Translators: Do not translate this, the translation is in Ideascube
birth_year = forms.IntegerField(label=_("Birth year"), required=True)
birth_year = forms.IntegerField(label=_("Birth year"), required=True,
min_value=current_year-150, max_value=current_year,
localize=True)
address = forms.CharField(label=_("Address"), widget=forms.Textarea,
required=False)
phone = forms.CharField(label=_("Phone number"), required=False)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment