Skip to content

Commit d3a20a8

Browse files
committed
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
1 parent c445611 commit d3a20a8

6 files changed

Lines changed: 73 additions & 9 deletions

File tree

ietf/meeting/admin.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,11 @@ class SchedTimeSessAssignmentAdmin(admin.ModelAdmin):
107107

108108

109109
class ResourceAssociationAdmin(admin.ModelAdmin):
110-
list_display = ["name", "icon", "desc", ]
110+
def used(self, instance):
111+
return instance.name.used
112+
used.boolean = True
113+
114+
list_display = ["name", "icon", "used", "desc"]
111115
admin.site.register(ResourceAssociation, ResourceAssociationAdmin)
112116

113117
class FloorPlanAdmin(admin.ModelAdmin):
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Copyright The IETF Trust 2017, All Rights Reserved
2+
# -*- coding: utf-8 -*-
3+
4+
from __future__ import unicode_literals
5+
6+
from django.db import migrations
7+
8+
9+
new_room_resources = [
10+
('u-shape', True, 0, 'boardroom-layout.png', 'Experimental Room Setup (U-Shape and classroom)',
11+
'Experimental Room Setup (U-Shape and classroom, subject to availability)', None),
12+
('flipcharts', True, 0, 'flipchart.png', 'Flipcharts',
13+
'Flipchars', 'Flipcharts: please specify number in Special Requests field'),
14+
]
15+
16+
unused_room_resources = [
17+
'boardroom',
18+
'project',
19+
'proj2',
20+
'meetecho',
21+
]
22+
23+
def forwards(apps,schema_editor):
24+
RoomResourceName = apps.get_model('name','RoomResourceName')
25+
ResourceAssociation = apps.get_model('meeting','ResourceAssociation')
26+
27+
for item in new_room_resources:
28+
slug, used, order, icon, name, desc, help = item
29+
if not help:
30+
help = desc
31+
name, __ = RoomResourceName.objects.get_or_create(slug=slug, name=name, desc=desc, used=used, order=order)
32+
ResourceAssociation.objects.get_or_create(name=name, icon=icon, desc=help)
33+
34+
for slug in unused_room_resources:
35+
res = RoomResourceName.objects.get(slug=slug)
36+
res.used = False
37+
res.save()
38+
39+
def backwards(apps,schema_editor):
40+
RoomResourceName = apps.get_model('name','RoomResourceName')
41+
ResourceAssociation = apps.get_model('meeting','ResourceAssociation')
42+
43+
for item in new_room_resources:
44+
slug, used, order, icon, name, desc, help = item
45+
if not help:
46+
help = desc
47+
RoomResourceName.objects.filter(slug=slug, name=name, desc=desc, used=used, order=order).delete()
48+
ResourceAssociation.objects.filter(name=name, icon=icon, desc=help).delete()
49+
50+
for slug in unused_room_resources:
51+
res = RoomResourceName.objects.get(slug=slug)
52+
res.used = True
53+
res.save()
54+
55+
56+
class Migration(migrations.Migration):
57+
58+
dependencies = [
59+
('meeting', '0049_auto_20170412_0528'),
60+
]
61+
62+
operations = [
63+
migrations.RunPython(forwards, backwards),
64+
]
948 Bytes
Loading
1.04 KB
Loading
893 Bytes
Loading

ietf/templates/doc/document_html.html

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
{% load origin %}
44
{% load staticfiles %}
55
{% load ietf_filters %}
6-
{% load cache %}
76

87
{% block pagehead %}
98
<link rel="alternate" type="application/atom+xml" title="Document changes" href="/feed/document-changes/{{ doc.name }}/">
@@ -51,13 +50,10 @@
5150
{% endif %}
5251
{% endcomment %}
5352

54-
{% with 1209600 as two_weeks %}
55-
{% cache two_weeks htmlized doc.canonical_name doc.rev using="htmlized" %}
56-
<div>
57-
{{ doc.htmlized|default:"Generation of htmlized text failed"|safe }}
58-
</div>
59-
{% endcache %}
60-
{% endwith %}
53+
<div>
54+
{{ doc.htmlized|default:"Generation of htmlized text failed"|safe }}
55+
</div>
56+
6157
</div>
6258
<div class="col-md-1"></div>
6359
<div class="col-md-1"></div>

0 commit comments

Comments
 (0)