summaryrefslogtreecommitdiff
path: root/src/meetingtools
diff options
context:
space:
mode:
Diffstat (limited to 'src/meetingtools')
-rw-r--r--src/meetingtools/apps/room/models.py18
-rw-r--r--src/meetingtools/apps/room/views.py2
2 files changed, 18 insertions, 2 deletions
diff --git a/src/meetingtools/apps/room/models.py b/src/meetingtools/apps/room/models.py
index aea4ba3..26d2566 100644
--- a/src/meetingtools/apps/room/models.py
+++ b/src/meetingtools/apps/room/models.py
@@ -13,6 +13,8 @@ from meetingtools.apps.cluster.models import ACCluster
import time
import tagging
from meetingtools.settings import BASE_URL
+from django.db.models.signals import post_save
+from tagging.models import Tag
class Room(models.Model):
creator = ForeignKey(User,editable=False)
@@ -56,4 +58,18 @@ class Room(models.Model):
else:
return self.user_count
-tagging.register(Room) \ No newline at end of file
+tagging.register(Room)
+
+def _magic_tags(sender,**kwargs):
+ room = kwargs['instance']
+ if room.self_cleaning:
+ Tag.objects.add_tag(room, "cleaning")
+ else:
+ tags = Tag.objects.get_for_object(room)
+ ntags = []
+ for tag in tags:
+ if tag.name != "cleaning":
+ ntags.append(tag.name)
+ Tag.objects.update_tags(room, ntags)
+
+post_save.connect(_magic_tags,sender=Room) \ No newline at end of file
diff --git a/src/meetingtools/apps/room/views.py b/src/meetingtools/apps/room/views.py
index 3bbc74a..97a487c 100644
--- a/src/meetingtools/apps/room/views.py
+++ b/src/meetingtools/apps/room/views.py
@@ -409,7 +409,7 @@ def list_by_tag(request,tn):
{'title':title,'description':title ,'edit':False,'baseurl': BASE_URL,'tags': tn,'rooms':rooms.all()})
def _can_tag(request,tag):
- if tag in ('selfcleaning','public','private'):
+ if tag in ('selfcleaning','cleaning','public','private'):
return False,"'%s' is reserved" % tag
# XXX implement access model for tags here soon
return True,""