Commit 4cb86dff authored by Matthieu Gautier's avatar Matthieu Gautier

Add a gender form.

parent 4a089e2f
......@@ -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
......@@ -44,6 +45,8 @@ class MessageForm(forms.Form):
address = forms.CharField(label=_("Locality"), widget=forms.Textarea,
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(
......
......@@ -24,6 +24,10 @@
<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 "Contact:" %}</span>
......
......@@ -35,6 +35,10 @@
<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 "Contact:" %}</span>
......
......@@ -21,6 +21,7 @@
{% form_field form.birth_year %}
{% form_field form.address %}
{% form_field form.contact %}
{% form_field form.gender %}
{% endblock sidebar %}
{% block extra_foot %}
......
......@@ -76,7 +76,8 @@ class MessageCreate(FormView):
# 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'])
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