Commit 05e8ec74 authored by Matthieu Gautier's avatar Matthieu Gautier

Merge branch 'cosmetic_participate' into 'master'

Cosmetic participate

See merge request !34
parents a8723120 4cb86dff
......@@ -3,6 +3,7 @@ from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from ideascube.models import User
from ideascube.mediacenter import utils
from ideascube.mediacenter.forms import DocumentForm
from ideascube.mediacenter.models import Document
......@@ -36,14 +37,16 @@ class ContentForm(forms.ModelForm):
class MessageForm(forms.Form):
# Translators: Do not translate this, the translation is in Ideascube
author = forms.CharField(label=_("Name"), max_length=100)
author = forms.CharField(label=_("First name and last name"), max_length=100)
# Translators: Do not translate this, the translation is in Ideascube
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,
address = forms.CharField(label=_("Locality"), widget=forms.Textarea,
required=False)
phone = forms.CharField(label=_("Phone number"), required=False)
contact = forms.CharField(label=_("Contact (Phone or email)"), required=False)
gender = forms.ChoiceField(label=_("Gender"), required=False,
choices=User.GENDER_CHOICES)
text = forms.CharField(label=_("Text"), widget=RichTextEntry,
required=False)
media = forms.FileField(
......@@ -58,7 +61,7 @@ class MessageForm(forms.Form):
))
kind = forms.ChoiceField(label=_("Object"),
choices=[('advertisement',
_('I want to publish an ad')),
_('I want to publish a communiqué')),
('message',
_('I want to leave a message'))])
......
......@@ -24,9 +24,13 @@
<span style="white-space: pre;">{{ content.author.camp_address }}</span>
</p>
{% endif %}
<p>
<span class="menu-subtitle">{% trans "Gender:" %}</span>
{{ content.author.gender }}
</p>
{% if content.author.phone %}
<p>
<span class="menu-subtitle">{% trans "Phone number:" %}</span>
<span class="menu-subtitle">{% trans "Contact:" %}</span>
{{ content.author.phone }}
</p>
{% endif %}
......
......@@ -35,9 +35,13 @@
<span style="white-space: pre;">{{ content.author.camp_address }}</span>
</p>
{% endif %}
<p>
<span class="menu-subtitle">{% trans "Gender:" %}</span>
{{ content.author.gender }}
</p>
{% if content.author.phone %}
<p>
<span class="menu-subtitle">{% trans "Phone number:" %}</span>
<span class="menu-subtitle">{% trans "Contact:" %}</span>
{{ content.author.phone }}
</p>
{% endif %}
......
......@@ -20,7 +20,8 @@
{% form_field form.author %}
{% form_field form.birth_year %}
{% form_field form.address %}
{% form_field form.phone %}
{% form_field form.contact %}
{% form_field form.gender %}
{% endblock sidebar %}
{% block extra_foot %}
......
......@@ -73,8 +73,11 @@ class MessageCreate(FormView):
serial=user_serial,
full_name=author,
birth_year=form.cleaned_data['birth_year'],
phone=form.cleaned_data['phone'],
camp_address=form.cleaned_data['address'])
# This is a nasty hack, we store the contact that can be
# something else than a phone number in the phone field.
phone=form.cleaned_data['contact'],
camp_address=form.cleaned_data['address'],
gender=form.cleaned_data['gender'])
break
except IntegrityError:
user_serial_id += 1
......
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