add label to room model
This commit is contained in:
parent
f270bbb280
commit
dad1f3babe
|
@ -10,7 +10,7 @@ class RoomForm(forms.ModelForm):
|
|||
|
||||
class Meta:
|
||||
model = Room
|
||||
fields = ['name', 'capacity']
|
||||
fields = ['name', 'label', 'capacity']
|
||||
|
||||
def clean_name(self):
|
||||
name = self.cleaned_data['name']
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10 on 2016-10-10 22:06
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('planning', '0002_auto_20161005_2108'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='room',
|
||||
name='label',
|
||||
field=models.CharField(blank=True, default='', max_length=256),
|
||||
),
|
||||
]
|
|
@ -9,8 +9,9 @@ from autoslug import AutoSlugField
|
|||
class Room(models.Model):
|
||||
|
||||
site = models.ForeignKey(Site, on_delete=models.CASCADE)
|
||||
name = models.CharField(max_length=256, blank=True, default="")
|
||||
slug = AutoSlugField(populate_from='name')
|
||||
name = models.CharField(max_length=256, blank=True, default="")
|
||||
label = models.CharField(max_length=256, blank=True, default="")
|
||||
capacity = models.IntegerField(default=0)
|
||||
|
||||
class Meta:
|
||||
|
|
|
@ -16,11 +16,14 @@
|
|||
{% for room in room_list %}
|
||||
<div class="col-xs-6 col-sm-4">
|
||||
<h2>{{ room }}</h2>
|
||||
{% if room.label %}<p>{{ room.label }}</p>{% endif %}
|
||||
<p>
|
||||
{{ room.capacity }} {% trans "place" %}{{ room.capacity|pluralize }}
|
||||
{% if request|staff %}
|
||||
|
|
||||
<a href="{% url 'edit-room' room.slug %}">{% bootstrap_icon "pencil" %}</a>
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
{% cycle '' '<div class="clearfix visible-xs"></div>' %}
|
||||
{% cycle '' '' '<div class="clearfix hidden-xs"></div>' %}
|
||||
|
|
Loading…
Reference in New Issue