OpenSlides/openslides/projector/models.py

41 lines
967 B
Python
Raw Normal View History

2012-02-03 20:49:16 +01:00
from django.db import models
from system.api import config_set, config_get
ELEMENT = {}
class Element(object):
2012-02-06 22:08:08 +01:00
def slide(self):
"""
2012-02-06 22:08:08 +01:00
Return a map with all Data for a Slide
"""
return {
'element': self,
'title': 'dummy-title',
}
@property
def eid(self):
"""
Return the eid from this element
"""
for key, value in ELEMENT.iteritems():
if type(self) == value:
return "%s %d" % (key, self.id)
return None
@property
def active(self):
"""
Return True, if the the element is the active one.
"""
2012-02-06 22:08:08 +01:00
from projector.api import get_active_element
return True if get_active_element(only_eid=True) == self.eid else False
def set_active(self):
"""
Appoint this item as the active one.
"""
config_set("presentation", "%s %d" % (self.prefix, self.id))