transport: outward and return city
This commit is contained in:
parent
21c6812433
commit
86c30f42a1
|
@ -12,7 +12,8 @@ UserForm = modelform_factory(User, fields=['first_name', 'last_name', 'email', '
|
|||
ProfileForm = modelform_factory(Profile, fields=['biography'])
|
||||
|
||||
ParticipationForm = modelform_factory(Participation,
|
||||
fields=['need_transport', 'transport', 'accommodation',
|
||||
fields=['need_transport', 'transport', 'transport_city_outward', 'transport_city_return',
|
||||
'accommodation',
|
||||
'connector', 'sound', 'videotaped',
|
||||
'video_licence', 'constraints'],
|
||||
widgets={'transport': forms.CheckboxSelectMultiple(),
|
||||
|
@ -24,7 +25,7 @@ ParticipationForm = modelform_factory(Participation,
|
|||
ProfileOrgaForm = modelform_factory(Profile, fields=['biography'])
|
||||
|
||||
ParticipationOrgaForm = modelform_factory(Participation,
|
||||
fields=['need_transport', 'transport', 'transport_booked',
|
||||
fields=['need_transport', 'transport', 'transport_city_outward', 'transport_city_return', 'transport_booked',
|
||||
'accommodation', 'accommodation_booked',
|
||||
'connector', 'sound', 'videotaped',
|
||||
'video_licence',
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10 on 2016-10-13 18:22
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('accounts', '0013_availabilitytimeslot'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='participation',
|
||||
name='transport_city_outward',
|
||||
field=models.CharField(blank=True, default='', max_length=256, verbose_name='Departure city'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='participation',
|
||||
name='transport_city_return',
|
||||
field=models.CharField(blank=True, default='', help_text='If different from departure city', max_length=256, verbose_name='Return city'),
|
||||
),
|
||||
]
|
|
@ -63,6 +63,8 @@ class Participation(PonyConfModel):
|
|||
arrival = models.DateTimeField(blank=True, null=True)
|
||||
departure = models.DateTimeField(blank=True, null=True)
|
||||
transport = models.ManyToManyField(Transport, verbose_name=_("I'm ok to travel by"), blank=True)
|
||||
transport_city_outward = models.CharField(blank=True, default='', max_length=256, verbose_name=_("Departure city"))
|
||||
transport_city_return = models.CharField(blank=True, default='', max_length=256, verbose_name=_("Return city"), help_text=_("If different from departure city"))
|
||||
transport_booked = models.BooleanField(default=False)
|
||||
|
||||
accommodation = models.IntegerField(choices=ACCOMMODATION_CHOICES, verbose_name=_('Need accommodation?'), null=True, blank=True)
|
||||
|
|
|
@ -22,10 +22,12 @@
|
|||
{% bootstrap_form user_form layout="horizontal" %}
|
||||
{% bootstrap_form profile_form layout="horizontal" %}
|
||||
{% bootstrap_field participation_form.need_transport layout="horizontal" %}
|
||||
<div id="transport_field">
|
||||
<div id="transport_fields">
|
||||
{% bootstrap_field participation_form.transport layout="horizontal" %}
|
||||
{% bootstrap_field participation_form.transport_city_outward layout="horizontal" %}
|
||||
{% bootstrap_field participation_form.transport_city_return layout="horizontal" %}
|
||||
</div>
|
||||
{% bootstrap_form participation_form exclude="need_transport,transport" layout="horizontal" %}
|
||||
{% bootstrap_form participation_form exclude="need_transport,transport,transport_city_outward,transport_city_return" layout="horizontal" %}
|
||||
{% buttons layout="horizontal" %}
|
||||
<button type="submit" class="btn btn-primary">{% trans "Submit" %}</button>
|
||||
{% for url, class, text in buttons %}
|
||||
|
@ -50,9 +52,9 @@
|
|||
<script type="text/javascript">
|
||||
var update_transport = function() {
|
||||
if ($('#id_need_transport').val() == 2) { // 2 == 'Yes'
|
||||
$("#transport_field").show();
|
||||
$("#transport_fields").show();
|
||||
} else {
|
||||
$("#transport_field").hide();
|
||||
$("#transport_fields").hide();
|
||||
}
|
||||
}
|
||||
$(function(){
|
||||
|
|
|
@ -27,11 +27,23 @@
|
|||
<h2>{% trans "Preferences" %}</h2>
|
||||
|
||||
<ul>
|
||||
<li><b>{% trans "Need transport:" %}</b> {{ participation.need_transport|yesno:"Yes,No,Not specified" }}</li>
|
||||
<li><b>{% trans "Arrival:" %}</b> {{ participation.arrival }}</li>
|
||||
<li><b>{% trans "Departure:" %}</b> {{ participation.departure }}</li>
|
||||
<li><b>{% trans "Ok to travel by:" %}</b> {% for transport in participation.transport.all %}{% if not forloop.first %}, {% endif %}{{ transport }}{% endfor %}</li>
|
||||
<li><b>{% trans "Transport booked:" %}</b> {{ participation.transport_booked|yesno }}</li>
|
||||
<li>
|
||||
<b>{% trans "Need transport:" %}</b> {{ participation.need_transport|yesno:"Yes,No,Not specified" }}
|
||||
{% if participation.need_transport %}
|
||||
<ul>
|
||||
{% comment %}
|
||||
<li><b>{% trans "Arrival:" %}</b> {{ participation.arrival }}</li>
|
||||
<li><b>{% trans "Departure:" %}</b> {{ participation.departure }}</li>
|
||||
{% endcomment %}
|
||||
<li><b>{% trans "Accepted transport means:" %}</b> {% for transport in participation.transport.all %}{% if not forloop.first %}, {% endif %}{{ transport }}{% endfor %}</li>
|
||||
<li><b>{% trans "Departure city:" %}</b> {{ participation.transport_city_outward|default:'Not specified' }}</li>
|
||||
{% if participation.transport_city_return %}
|
||||
<li><b>{% trans "Return city:" %}</b> {{ participation.transport_city_return }}</li>
|
||||
{% endif %}
|
||||
<li><b>{% trans "Transport booked:" %}</b> {{ participation.transport_booked|yesno }}</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
<li><b>{% trans "Need accommodation:" %}</b> {% if participation.accommodation is None %}Not specified{% else %}{{ participation.get_accommodation_display }}{% endif %}</li>
|
||||
<li><b>{% trans "Accommodation booked:" %}</b> {{ participation.accommodation_booked|yesno }}</li>
|
||||
<li><b>{% trans "Video output:" %}</b> {% for conn in participation.connector.all %}{% if not forloop.first %}, {% endif %}{{ conn }}{% endfor %}</li>
|
||||
|
|
Loading…
Reference in New Issue