2016-01-25 14:48:00 +01:00
|
|
|
from django.contrib.auth.models import Permission
|
|
|
|
from django.contrib.contenttypes.models import ContentType
|
2015-06-17 18:32:05 +02:00
|
|
|
from django.core.validators import MaxLengthValidator
|
2016-01-25 14:48:00 +01:00
|
|
|
from django.db.models import Q
|
2015-02-12 20:57:05 +01:00
|
|
|
from django.dispatch import Signal
|
2013-09-25 10:01:01 +02:00
|
|
|
from django.utils.translation import ugettext as _
|
2015-06-17 18:32:05 +02:00
|
|
|
from django.utils.translation import ugettext_lazy
|
2013-03-01 17:13:12 +01:00
|
|
|
|
2015-06-29 12:08:15 +02:00
|
|
|
from openslides.core.config import ConfigVariable
|
2013-03-11 21:32:09 +01:00
|
|
|
|
2015-02-12 20:57:05 +01:00
|
|
|
# This signal is sent when the migrate command is done. That means it is sent
|
|
|
|
# after post_migrate sending and creating all Permission objects. Don't use it
|
|
|
|
# for other things than dealing with Permission objects.
|
|
|
|
post_permission_creation = Signal()
|
|
|
|
|
2013-03-01 17:13:12 +01:00
|
|
|
|
2016-01-25 14:48:00 +01:00
|
|
|
def delete_django_app_permissions(sender, **kwargs):
|
|
|
|
"""
|
|
|
|
Deletes the permissions, Django creates by default. Only required
|
|
|
|
for auth, contenttypes and sessions.
|
|
|
|
"""
|
|
|
|
contenttypes = ContentType.objects.filter(
|
|
|
|
Q(app_label='auth') |
|
|
|
|
Q(app_label='contenttypes') |
|
|
|
|
Q(app_label='sessions'))
|
|
|
|
for permission in Permission.objects.filter(content_type__in=contenttypes):
|
|
|
|
permission.delete()
|
|
|
|
|
|
|
|
|
2013-12-02 19:33:43 +01:00
|
|
|
def setup_general_config(sender, **kwargs):
|
2013-03-01 17:13:12 +01:00
|
|
|
"""
|
2014-11-13 22:23:16 +01:00
|
|
|
Receiver function to setup general config variables for OpenSlides.
|
2015-06-17 18:32:05 +02:00
|
|
|
There are two main groups: 'General' and 'Projector'. The group
|
|
|
|
'General' has subgroups. This function is connected to the signal
|
2015-06-29 12:08:15 +02:00
|
|
|
openslides.core.signals.config_signal during app loading.
|
2013-03-01 17:13:12 +01:00
|
|
|
"""
|
2015-06-17 18:32:05 +02:00
|
|
|
# General Event
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='general_event_name',
|
2013-03-01 17:13:12 +01:00
|
|
|
default_value='OpenSlides',
|
2015-06-17 18:32:05 +02:00
|
|
|
label=ugettext_lazy('Event name'),
|
|
|
|
weight=110,
|
|
|
|
group=ugettext_lazy('General'),
|
|
|
|
subgroup=ugettext_lazy('Event'),
|
|
|
|
validators=(MaxLengthValidator(50),))
|
2013-03-01 17:13:12 +01:00
|
|
|
|
2015-06-17 18:32:05 +02:00
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='general_event_description',
|
2013-03-01 17:13:12 +01:00
|
|
|
default_value=_('Presentation and assembly system'),
|
2015-06-17 18:32:05 +02:00
|
|
|
label=ugettext_lazy('Short description of event'),
|
|
|
|
weight=115,
|
|
|
|
group=ugettext_lazy('General'),
|
|
|
|
subgroup=ugettext_lazy('Event'),
|
|
|
|
validators=(MaxLengthValidator(100),),
|
|
|
|
translatable=True)
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='general_event_date',
|
2013-03-01 17:13:12 +01:00
|
|
|
default_value='',
|
2015-06-17 18:32:05 +02:00
|
|
|
label=ugettext_lazy('Event date'),
|
|
|
|
weight=120,
|
|
|
|
group=ugettext_lazy('General'),
|
|
|
|
subgroup=ugettext_lazy('Event'))
|
2013-03-01 17:13:12 +01:00
|
|
|
|
2015-06-17 18:32:05 +02:00
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='general_event_location',
|
2013-03-01 17:13:12 +01:00
|
|
|
default_value='',
|
2015-06-17 18:32:05 +02:00
|
|
|
label=ugettext_lazy('Event location'),
|
|
|
|
weight=125,
|
|
|
|
group=ugettext_lazy('General'),
|
|
|
|
subgroup=ugettext_lazy('Event'))
|
2013-03-01 17:13:12 +01:00
|
|
|
|
2015-06-17 18:32:05 +02:00
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='general_event_organizer',
|
2013-03-01 17:13:12 +01:00
|
|
|
default_value='',
|
2015-06-17 18:32:05 +02:00
|
|
|
label=ugettext_lazy('Event organizer'),
|
|
|
|
weight=130,
|
|
|
|
group=ugettext_lazy('General'),
|
|
|
|
subgroup=ugettext_lazy('Event'))
|
|
|
|
|
2016-01-09 12:51:26 +01:00
|
|
|
yield ConfigVariable(
|
2016-01-09 14:44:49 +01:00
|
|
|
name='general_event_legal_notice',
|
2016-01-09 15:22:34 +01:00
|
|
|
default_value=_(
|
|
|
|
'<a href="http://www.openslides.org">OpenSlides</a> is a free web based '
|
|
|
|
'presentation and assembly system for visualizing and controlling agenda, '
|
|
|
|
'motions and elections of an assembly.'),
|
2016-01-09 12:51:26 +01:00
|
|
|
input_type='text',
|
2016-01-09 14:44:49 +01:00
|
|
|
label=ugettext_lazy('Legal notice'),
|
2016-01-09 12:51:26 +01:00
|
|
|
weight=132,
|
|
|
|
group=ugettext_lazy('General'),
|
2016-01-09 15:22:34 +01:00
|
|
|
subgroup=ugettext_lazy('Event'),
|
|
|
|
translatable=True)
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name='general_event_welcome_title',
|
|
|
|
default_value=_('Welcome to OpenSlides'),
|
|
|
|
label=ugettext_lazy('Front page title'),
|
|
|
|
weight=134,
|
|
|
|
group=ugettext_lazy('General'),
|
|
|
|
subgroup=ugettext_lazy('Event'),
|
|
|
|
translatable=True)
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name='general_event_welcome_text',
|
|
|
|
default_value=_('[Space for your welcome text.]'),
|
|
|
|
input_type='text',
|
|
|
|
label=ugettext_lazy('Front page text'),
|
|
|
|
weight=136,
|
|
|
|
group=ugettext_lazy('General'),
|
|
|
|
subgroup=ugettext_lazy('Event'),
|
|
|
|
translatable=True)
|
2016-01-09 12:51:26 +01:00
|
|
|
|
2015-06-17 18:32:05 +02:00
|
|
|
# General System
|
2013-03-01 17:13:12 +01:00
|
|
|
|
2015-06-17 18:32:05 +02:00
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='general_system_enable_anonymous',
|
|
|
|
default_value=False,
|
2015-06-17 18:32:05 +02:00
|
|
|
input_type='boolean',
|
|
|
|
label=ugettext_lazy('Allow access for anonymous guest users'),
|
2016-01-09 15:22:34 +01:00
|
|
|
weight=138,
|
2015-06-17 18:32:05 +02:00
|
|
|
group=ugettext_lazy('General'),
|
|
|
|
subgroup=ugettext_lazy('System'))
|
2015-06-16 18:12:59 +02:00
|
|
|
|
2016-01-09 01:10:37 +01:00
|
|
|
yield ConfigVariable(
|
|
|
|
name='general_login_info_text',
|
|
|
|
default_value='',
|
|
|
|
label=ugettext_lazy('Show this text on the login page.'),
|
|
|
|
weight=140,
|
|
|
|
group=ugettext_lazy('General'),
|
|
|
|
subgroup=ugettext_lazy('System'))
|
|
|
|
|
2015-06-17 18:32:05 +02:00
|
|
|
# Projector
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
2013-11-09 23:04:50 +01:00
|
|
|
name='projector_enable_logo',
|
|
|
|
default_value=True,
|
2015-06-17 18:32:05 +02:00
|
|
|
input_type='boolean',
|
|
|
|
label=ugettext_lazy('Show logo on projector'),
|
2015-11-06 17:25:25 +01:00
|
|
|
help_text=ugettext_lazy(
|
|
|
|
'You can replace the logo. Just copy a file to '
|
2015-11-29 22:25:01 +01:00
|
|
|
'"static/img/logo-projector.png" in your OpenSlides data path.'),
|
2015-06-17 18:32:05 +02:00
|
|
|
weight=150,
|
|
|
|
group=ugettext_lazy('Projector'))
|
2013-11-09 23:04:50 +01:00
|
|
|
|
2015-06-17 18:32:05 +02:00
|
|
|
yield ConfigVariable(
|
2013-11-09 23:04:50 +01:00
|
|
|
name='projector_enable_title',
|
|
|
|
default_value=True,
|
2015-06-17 18:32:05 +02:00
|
|
|
input_type='boolean',
|
|
|
|
label=ugettext_lazy('Show title and description of event on projector'),
|
|
|
|
weight=155,
|
|
|
|
group=ugettext_lazy('Projector'))
|
2013-11-09 23:04:50 +01:00
|
|
|
|
2015-06-17 18:32:05 +02:00
|
|
|
yield ConfigVariable(
|
2016-01-13 00:07:53 +01:00
|
|
|
name='projector_backgroundcolor',
|
|
|
|
default_value='#317796',
|
2016-02-21 22:03:25 +01:00
|
|
|
input_type='colorpicker',
|
2015-06-17 18:32:05 +02:00
|
|
|
label=ugettext_lazy('Background color of projector header'),
|
|
|
|
help_text=ugettext_lazy('Use web color names like "red" or hex numbers like "#ff0000".'),
|
|
|
|
weight=160,
|
|
|
|
group=ugettext_lazy('Projector'))
|
2013-11-09 23:04:50 +01:00
|
|
|
|
2015-09-05 14:58:10 +02:00
|
|
|
yield ConfigVariable(
|
|
|
|
name='projector_default_countdown',
|
|
|
|
default_value=60,
|
|
|
|
label=ugettext_lazy('Default countdown'),
|
|
|
|
weight=185,
|
|
|
|
group=ugettext_lazy('Projector'))
|
|
|
|
|
2015-06-29 12:08:15 +02:00
|
|
|
|
|
|
|
config_signal = Signal(providing_args=[])
|
|
|
|
"""Signal to get all config tabs from all apps."""
|