Added filtering of room resources in the session request form based on the 'used' flag of the room resource name. Tweaked admin to show 'used' for ResourceAssociations. Added Flipchart and U-shape-layout resources through a data migration, and added/modified resource icons.

- Legacy-Id: 13225
This commit is contained in:
Henrik Levkowetz 2017-04-15 19:13:06 +00:00
parent c445611904
commit d3a20a8694
6 changed files with 73 additions and 9 deletions

View file

@ -107,7 +107,11 @@ admin.site.register(SchedTimeSessAssignment, SchedTimeSessAssignmentAdmin)
class ResourceAssociationAdmin(admin.ModelAdmin):
list_display = ["name", "icon", "desc", ]
def used(self, instance):
return instance.name.used
used.boolean = True
list_display = ["name", "icon", "used", "desc"]
admin.site.register(ResourceAssociation, ResourceAssociationAdmin)
class FloorPlanAdmin(admin.ModelAdmin):

View file

@ -0,0 +1,64 @@
# Copyright The IETF Trust 2017, All Rights Reserved
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
new_room_resources = [
('u-shape', True, 0, 'boardroom-layout.png', 'Experimental Room Setup (U-Shape and classroom)',
'Experimental Room Setup (U-Shape and classroom, subject to availability)', None),
('flipcharts', True, 0, 'flipchart.png', 'Flipcharts',
'Flipchars', 'Flipcharts: please specify number in Special Requests field'),
]
unused_room_resources = [
'boardroom',
'project',
'proj2',
'meetecho',
]
def forwards(apps,schema_editor):
RoomResourceName = apps.get_model('name','RoomResourceName')
ResourceAssociation = apps.get_model('meeting','ResourceAssociation')
for item in new_room_resources:
slug, used, order, icon, name, desc, help = item
if not help:
help = desc
name, __ = RoomResourceName.objects.get_or_create(slug=slug, name=name, desc=desc, used=used, order=order)
ResourceAssociation.objects.get_or_create(name=name, icon=icon, desc=help)
for slug in unused_room_resources:
res = RoomResourceName.objects.get(slug=slug)
res.used = False
res.save()
def backwards(apps,schema_editor):
RoomResourceName = apps.get_model('name','RoomResourceName')
ResourceAssociation = apps.get_model('meeting','ResourceAssociation')
for item in new_room_resources:
slug, used, order, icon, name, desc, help = item
if not help:
help = desc
RoomResourceName.objects.filter(slug=slug, name=name, desc=desc, used=used, order=order).delete()
ResourceAssociation.objects.filter(name=name, icon=icon, desc=help).delete()
for slug in unused_room_resources:
res = RoomResourceName.objects.get(slug=slug)
res.used = True
res.save()
class Migration(migrations.Migration):
dependencies = [
('meeting', '0049_auto_20170412_0528'),
]
operations = [
migrations.RunPython(forwards, backwards),
]

Binary file not shown.

After

(image error) Size: 948 B

Binary file not shown.

Before

(image error) Size: 890 B

After

(image error) Size: 1.9 KiB

Binary file not shown.

Before

(image error) Size: 1 KiB

After

(image error) Size: 1.9 KiB

View file

@ -3,7 +3,6 @@
{% load origin %}
{% load staticfiles %}
{% load ietf_filters %}
{% load cache %}
{% block pagehead %}
<link rel="alternate" type="application/atom+xml" title="Document changes" href="/feed/document-changes/{{ doc.name }}/">
@ -51,13 +50,10 @@
{% endif %}
{% endcomment %}
{% with 1209600 as two_weeks %}
{% cache two_weeks htmlized doc.canonical_name doc.rev using="htmlized" %}
<div>
{{ doc.htmlized|default:"Generation of htmlized text failed"|safe }}
</div>
{% endcache %}
{% endwith %}
<div>
{{ doc.htmlized|default:"Generation of htmlized text failed"|safe }}
</div>
</div>
<div class="col-md-1"></div>
<div class="col-md-1"></div>