Add UserSlide with new template.

This commit is contained in:
Norman Jäckel 2012-11-06 00:02:44 +01:00
parent 79e619949a
commit 35e41873a0
2 changed files with 57 additions and 1 deletions

View File

@ -22,8 +22,11 @@ from openslides.utils.person.signals import receive_persons
from openslides.config.models import config from openslides.config.models import config
from openslides.config.signals import default_config_value from openslides.config.signals import default_config_value
from openslides.projector.api import register_slidemodel
from openslides.projector.projector import SlideMixin
class User(DjangoUser, PersonMixin, Person): class User(DjangoUser, PersonMixin, Person, SlideMixin):
prefix = 'user' # This is for the slides
person_prefix = 'user' person_prefix = 'user'
GENDER_CHOICES = ( GENDER_CHOICES = (
('male', _('Male')), ('male', _('Male')),
@ -111,6 +114,16 @@ class User(DjangoUser, PersonMixin, Person):
) )
ordering = ('last_name',) ordering = ('last_name',)
def slide(self):
"""
Returns a map with the data for the slides.
"""
return {
'shown_user': self,
'title': self.clean_name,
'template': 'projector/UserSlide.html'}
register_slidemodel(User)
class Group(DjangoGroup, PersonMixin, Person): class Group(DjangoGroup, PersonMixin, Person):
person_prefix = 'group' person_prefix = 'group'

View File

@ -0,0 +1,43 @@
{% extends "base-projector.html" %}
{% load i18n %}
{% load tags %}
{% block title %}{{ block.super }} - {{ title }}{% endblock %}
{% block content %}
<div id='sidebar'>
<div class='box'>
<p><strong>{% trans "Groups" %}</strong><br />
{% for group in shown_user.groups.all %}
{{ group }},
{% empty %}
{% trans "The participant is not member of any group." %}
{% endfor %}
</p>
{% if shown_user.get_gender_display %}
<p><strong>{% trans "Gender" %}</strong><br />{{ shown_user.get_gender_display }}</p>
{% endif %}
{% if shown_user.get_type_display %}
<p><strong>{% trans "Type" %}</strong><br />{{ shown_user.get_type_display }}</p>
{% endif %}
{% if shown_user.committee %}
<p><strong>{% trans "Committee" %}</strong><br />{{ shown_user.committee }}</p>
{% endif %}
</div>
</div>
<h1>{{ shown_user }}</h1>
<p>{{ shown_user.email }}</p>
{% endblock %}
{% block scrollcontent %}
<p>
<div class="text">{{ shown_user.about_me|linebreaks }}</div>
</p>
{% endblock %}