OpenSlides/openslides/projector/models.py
Norman Jäckel e1b149cde3 New config app. Apps only have to define config vars once. Config pages, forms and so on are created automaticly.
Changes after some reviews are done.

Problematic is still that the JS can not be moved to an extra file because of the template tags in the code.
2013-03-28 15:31:13 +01:00

71 lines
2.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
openslides.projector.models
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Models for the projector app.
:copyright: 20112013 by OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
from django.db import models
from django.dispatch import receiver
from django.utils.translation import ugettext_lazy as _, ugettext_noop
from openslides.projector.api import register_slidemodel
from openslides.projector.projector import SlideMixin
class ProjectorSlide(models.Model, SlideMixin):
"""
Model for Slides, only for the projector. Also called custom slides.
"""
prefix = 'ProjectorSlide'
title = models.CharField(max_length=256, verbose_name=_("Title"))
text = models.TextField(null=True, blank=True, verbose_name=_("Text"))
weight = models.IntegerField(default=0, verbose_name=_("Weight"))
def slide(self):
return {
'slide': self,
'title': self.title,
'template': 'projector/ProjectorSlide.html',
}
@models.permalink
def get_absolute_url(self, link='edit'):
if link == 'edit':
return ('customslide_edit', [str(self.id)])
if link == 'delete':
return ('customslide_delete', [str(self.id)])
def __unicode__(self):
return self.title
class Meta:
permissions = (
('can_manage_projector', ugettext_noop("Can manage the projector")),
('can_see_projector', ugettext_noop("Can see the projector")),
('can_see_dashboard', ugettext_noop("Can see the dashboard")),
)
register_slidemodel(ProjectorSlide, control_template='projector/control_customslide.html')
class ProjectorOverlay(models.Model):
"""
Save information for a overlay.
"""
active = models.BooleanField(verbose_name=_('Active'))
def_name = models.CharField(max_length=64)
sid = models.CharField(max_length=64, null=True, blank=True)
def __unicode__(self):
if self.sid:
return "%s on %s" % (self.def_name, self.sid)
return self.def_name