1fb1f17d15
It is now possible to define a default state and to submit extra stylefiles and javascript files when defining a widget in an app. This is done by a new metaclass in openslides.utils.dispatch. Also fixed some other tests.
46 lines
1.3 KiB
Python
46 lines
1.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
from django.utils.translation import ugettext_lazy
|
|
|
|
from openslides.utils.widgets import Widget
|
|
|
|
from .models import Group, User
|
|
|
|
|
|
class UserWidget(Widget):
|
|
"""
|
|
Provides a widget with all users. This is for short activation of
|
|
user slides.
|
|
"""
|
|
name = 'user'
|
|
verbose_name = ugettext_lazy('Participants')
|
|
permission_required = 'projector.can_manage_projector'
|
|
default_column = 1
|
|
default_weight = 60
|
|
template_name = 'participant/widget_user.html'
|
|
more_link_pattern_name = 'user_overview'
|
|
|
|
def get_context_data(self, **context):
|
|
return super(UserWidget, self).get_context_data(
|
|
users=User.objects.all(),
|
|
**context)
|
|
|
|
|
|
class GroupWidget(Widget):
|
|
"""
|
|
Provides a widget with all groups. This is for short activation of
|
|
group slides.
|
|
"""
|
|
name = 'group'
|
|
verbose_name = ugettext_lazy('Groups')
|
|
permission_required = 'projector.can_manage_projector'
|
|
default_column = 1
|
|
default_weight = 70
|
|
template_name = 'participant/widget_group.html'
|
|
more_link_pattern_name = 'user_group_overview'
|
|
|
|
def get_context_data(self, **context):
|
|
return super(GroupWidget, self).get_context_data(
|
|
groups=Group.objects.all(),
|
|
**context)
|