2012-04-25 22:29:19 +02:00
|
|
|
|
#!/usr/bin/env python
|
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
"""
|
|
|
|
|
openslides.projector.models
|
2012-07-07 14:01:40 +02:00
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2012-04-25 22:29:19 +02:00
|
|
|
|
|
|
|
|
|
Models for the projector app.
|
|
|
|
|
|
2013-03-01 17:13:12 +01:00
|
|
|
|
:copyright: 2011–2013 by OpenSlides team, see AUTHORS.
|
2012-04-25 22:29:19 +02:00
|
|
|
|
:license: GNU GPL, see LICENSE for more details.
|
|
|
|
|
"""
|
2012-04-18 18:55:33 +02:00
|
|
|
|
|
2012-02-03 20:49:16 +01:00
|
|
|
|
from django.db import models
|
2012-04-16 16:35:30 +02:00
|
|
|
|
from django.dispatch import receiver
|
2013-04-22 19:59:05 +02:00
|
|
|
|
from django.utils.translation import ugettext_lazy, ugettext_noop
|
2012-04-16 16:35:30 +02:00
|
|
|
|
|
2012-07-07 14:01:40 +02:00
|
|
|
|
from openslides.projector.api import register_slidemodel
|
|
|
|
|
from openslides.projector.projector import SlideMixin
|
|
|
|
|
|
2012-04-14 12:52:56 +02:00
|
|
|
|
|
2012-03-12 18:22:18 +01:00
|
|
|
|
class ProjectorSlide(models.Model, SlideMixin):
|
2012-07-07 14:01:40 +02:00
|
|
|
|
"""
|
|
|
|
|
Model for Slides, only for the projector. Also called custom slides.
|
|
|
|
|
"""
|
2012-03-12 18:22:18 +01:00
|
|
|
|
prefix = 'ProjectorSlide'
|
|
|
|
|
|
2013-04-22 19:59:05 +02:00
|
|
|
|
title = models.CharField(max_length=256, verbose_name=ugettext_lazy("Title"))
|
|
|
|
|
text = models.TextField(null=True, blank=True, verbose_name=ugettext_lazy("Text"))
|
|
|
|
|
weight = models.IntegerField(default=0, verbose_name=ugettext_lazy("Weight"))
|
2012-03-12 18:22:18 +01:00
|
|
|
|
|
2012-04-14 11:37:12 +02:00
|
|
|
|
def slide(self):
|
|
|
|
|
return {
|
|
|
|
|
'slide': self,
|
|
|
|
|
'title': self.title,
|
|
|
|
|
'template': 'projector/ProjectorSlide.html',
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-18 23:24:54 +02:00
|
|
|
|
@models.permalink
|
2013-02-03 19:43:36 +01:00
|
|
|
|
def get_absolute_url(self, link='edit'):
|
|
|
|
|
if link == 'edit':
|
|
|
|
|
return ('customslide_edit', [str(self.id)])
|
2012-05-18 23:24:54 +02:00
|
|
|
|
if link == 'delete':
|
|
|
|
|
return ('customslide_delete', [str(self.id)])
|
|
|
|
|
|
2012-03-12 18:22:18 +01:00
|
|
|
|
def __unicode__(self):
|
|
|
|
|
return self.title
|
|
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
|
permissions = (
|
2012-07-07 14:01:40 +02:00
|
|
|
|
('can_manage_projector', ugettext_noop("Can manage the projector")),
|
2012-08-15 10:58:29 +02:00
|
|
|
|
('can_see_projector', ugettext_noop("Can see the projector")),
|
|
|
|
|
('can_see_dashboard', ugettext_noop("Can see the dashboard")),
|
2012-03-12 18:22:18 +01:00
|
|
|
|
)
|
|
|
|
|
|
2012-04-14 09:47:34 +02:00
|
|
|
|
|
2012-11-24 14:01:21 +01:00
|
|
|
|
register_slidemodel(ProjectorSlide, control_template='projector/control_customslide.html')
|