dc7d27a985
Added custom slide projector element class. Added welcome slide as custom slide. Added user slide projector element class. Added clock, countdown ans message projector elements. Renamed SignalConnectMetaClass classmethod get_all_objects to get_all (private API). Added migrations to core app. Fixed and wrote tests. Updated CHANGELOG.
30 lines
817 B
Python
30 lines
817 B
Python
from django.utils.translation import ugettext as _
|
|
|
|
from openslides.core.exceptions import ProjectorException
|
|
from openslides.utils.projector import ProjectorElement
|
|
|
|
from .models import User
|
|
|
|
|
|
class UserSlide(ProjectorElement):
|
|
"""
|
|
Slide definitions for user model.
|
|
"""
|
|
name = 'users/user'
|
|
scripts = 'users/user_slide.js'
|
|
|
|
def get_context(self):
|
|
pk = self.config_entry.get('id')
|
|
try:
|
|
user = User.objects.get(pk=pk)
|
|
except User.DoesNotExist:
|
|
raise ProjectorException(_('User does not exist.'))
|
|
result = [{
|
|
'collection': 'users/user',
|
|
'id': pk}]
|
|
for group in user.groups.all():
|
|
result.append({
|
|
'collection': 'users/group',
|
|
'id': group.pk})
|
|
return result
|