add sound field to room model, fix #81

This commit is contained in:
Guilhem Saurel 2017-05-26 13:20:25 +02:00
parent 6911177bda
commit 7da7df56b2
5 changed files with 27 additions and 2 deletions

View File

@ -10,7 +10,7 @@ class RoomForm(forms.ModelForm):
class Meta:
model = Room
fields = ['name', 'label', 'capacity']
fields = ['name', 'label', 'capacity', 'sound']
def clean_name(self):
name = self.cleaned_data['name']

View File

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-05-26 11:18
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('planning', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='room',
name='sound',
field=models.BooleanField(default=False),
),
]

View File

@ -14,6 +14,7 @@ class Room(models.Model):
name = models.CharField(max_length=256, blank=True, default="")
label = models.CharField(max_length=256, blank=True, default="")
capacity = models.IntegerField(default=0)
sound = models.BooleanField(default=False)
class Meta:
unique_together = ['site', 'name']

View File

@ -8,6 +8,7 @@
<h1>{{ room.name }}
<small>{{ room.label }}</small>
<span class="glyphicon glyphicon-volume-{% if room.sound %}up{% else %}off{% endif %}"></span>
</h1>
<h2>{% trans "Scheduled talks" %}</h2>

View File

@ -15,7 +15,10 @@
<div class="row">
{% for room in room_list %}
<div class="col-xs-6 col-sm-4">
<h2><a href="{% url 'show-room' room.slug %}">{{ room }}</a></h2>
<h2>
<a href="{% url 'show-room' room.slug %}">{{ room }}</a>
<span class="glyphicon glyphicon-volume-{% if room.sound %}up{% else %}off{% endif %}"></span>
</h2>
{% if room.label %}<p>{{ room.label }}</p>{% endif %}
<p>
{{ room.capacity }} {% trans "place" %}{{ room.capacity|pluralize }}