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