forked from AFPy/PonyConf
transport_needed: BooleanField -> NullBooleanField
This commit is contained in:
parent
e7a1060667
commit
07ce34055f
35
accounts/migrations/0011_auto_20161005_1841.py
Normal file
35
accounts/migrations/0011_auto_20161005_1841.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10 on 2016-10-05 18:41
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
def transport_false_to_none(apps, schema_editor):
|
||||
db_alias = schema_editor.connection.alias
|
||||
Participation = apps.get_model('accounts', 'Participation')
|
||||
for participation in Participation.objects.using(db_alias).all():
|
||||
if participation.need_transport == False:
|
||||
participation.need_transport = None
|
||||
participation.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('accounts', '0010_auto_20161003_1152'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='participation',
|
||||
name='need_transport',
|
||||
field=models.NullBooleanField(default=None, verbose_name='Need transport?'),
|
||||
),
|
||||
migrations.RunPython(transport_false_to_none),
|
||||
migrations.AlterField(
|
||||
model_name='participation',
|
||||
name='notes',
|
||||
field=models.TextField(blank=True, default='', help_text='This field is only visible by organizers.', verbose_name='Notes'),
|
||||
),
|
||||
]
|
|
@ -51,7 +51,7 @@ class Participation(PonyConfModel):
|
|||
user = models.ForeignKey(User)
|
||||
|
||||
|
||||
need_transport = models.BooleanField(verbose_name=_('Need transport?'), default=False)
|
||||
need_transport = models.NullBooleanField(verbose_name=_('Need transport?'), default=None)
|
||||
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)
|
||||
|
|
|
@ -60,10 +60,14 @@
|
|||
{% for transport in speaker.transport.all %}
|
||||
{% if not forloop.first %}, {% endif %}
|
||||
{{ transport }}
|
||||
{% empty %}
|
||||
Yes
|
||||
{% endfor %}
|
||||
</td>
|
||||
{% elif speaker.need_transport is None %}
|
||||
<td>?</td>
|
||||
{% else %}
|
||||
<td>—</td>
|
||||
<td>No</td>
|
||||
{% endif %}
|
||||
{% if speaker.need_hosting %}
|
||||
<td class="{% if speaker.hosting_booked %}success{% else %}warning{% endif %}">
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<h2>{% trans "Preferences" %}</h2>
|
||||
|
||||
<ul>
|
||||
<li><b>{% trans "Need transport:" %}</b> {{ participation.need_transport|yesno }}</li>
|
||||
<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>
|
||||
|
|
Loading…
Reference in New Issue
Block a user