Skip to content
Snippets Groups Projects
Commit 63a7291f authored by Nadja Geisler's avatar Nadja Geisler :sunny: Committed by Benjamin Hättasch
Browse files

rename room's building to lacation

more general model
parent 01681abe
No related branches found
No related tags found
No related merge requests found
......@@ -141,10 +141,10 @@ class AKAdmin(SimpleHistoryAdmin):
@admin.register(Room)
class RoomAdmin(admin.ModelAdmin):
model = Room
list_display = ['name', 'building', 'capacity', 'event']
list_filter = ['building', 'properties', 'event']
list_display = ['name', 'location', 'capacity', 'event']
list_filter = ['location', 'properties', 'event']
list_editable = []
ordering = ['building', 'name']
ordering = ['location', 'name']
def formfield_for_foreignkey(self, db_field, request, **kwargs):
if db_field.name == 'event':
......
......@@ -425,8 +425,8 @@ msgid "Building"
msgstr "Gebäude"
#: AKModel/models.py:262
msgid "Name or number of the building"
msgstr "Name oder Nummer des Gebäudes"
msgid "Name or number of the location"
msgstr "Name oder Nummer des Ortes"
#: AKModel/models.py:263
msgid "Capacity"
......
# Generated by Django 3.0.6 on 2020-05-17 20:02
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('AKModel', '0032_AK_history'),
]
operations = [
migrations.RenameField(
model_name='room',
old_name='building',
new_name='location',
),
]
from datetime import timedelta
from django.utils.datetime_safe import datetime
import itertools
from datetime import timedelta
from django.db import models
from django.utils import timezone
from django.utils.datetime_safe import datetime
from django.utils.text import slugify
from django.utils.translation import gettext_lazy as _
from simple_history.models import HistoricalRecords
......@@ -258,8 +257,8 @@ class Room(models.Model):
""" A room describes where an AK can be held.
"""
name = models.CharField(max_length=64, verbose_name=_('Name'), help_text=_('Name or number of the room'))
building = models.CharField(max_length=256, blank=True, verbose_name=_('Building'),
help_text=_('Name or number of the building'))
location = models.CharField(max_length=256, blank=True, verbose_name=_('Location'),
help_text=_('Name or number of the location'))
capacity = models.IntegerField(verbose_name=_('Capacity'), help_text=_('Maximum number of people'))
properties = models.ManyToManyField(to=AKRequirement, blank=True, verbose_name=_('Properties'),
help_text=_('AK requirements fulfilled by the room'))
......@@ -270,13 +269,13 @@ class Room(models.Model):
class Meta:
verbose_name = _('Room')
verbose_name_plural = _('Rooms')
ordering = ['building', 'name']
unique_together = ['event', 'name', 'building']
ordering = ['location', 'name']
unique_together = ['event', 'name', 'location']
@property
def title(self):
if self.building:
return f"{self.building} {self.name}"
if self.location:
return f"{self.location} {self.name}"
return self.name
def __str__(self):
......
......@@ -38,8 +38,8 @@ class PlanIndexView(FilterByEventSlugMixin, ListView):
if akslot.room is not None:
rooms.add(akslot.room)
# Store buildings for hierarchical view
if akslot.room.building != '':
buildings.add(akslot.room.building)
if akslot.room.location != '':
buildings.add(akslot.room.location)
# Recent AKs: Started but not ended yet
if akslot.start <= current_timestamp <= akslot.end:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment