#315 remove application from agenda by appending a new methode get_application_title_supplement

This commit is contained in:
Oskar Hahn 2012-07-20 11:22:09 +02:00
parent 078125a1a2
commit ff4529d8eb
3 changed files with 20 additions and 13 deletions

View File

@ -18,7 +18,7 @@ except ImportError:
from django.db import models from django.db import models
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _, ugettext_noop from django.utils.translation import ugettext_lazy as _, ugettext_noop, ugettext
from mptt.models import MPTTModel, TreeForeignKey from mptt.models import MPTTModel, TreeForeignKey
@ -67,7 +67,7 @@ class Item(MPTTModel, SlideMixin):
For use in Template For use in Template
??Why does {% trans item.print_related_type|capfirst %} not work?? ??Why does {% trans item.print_related_type|capfirst %} not work??
""" """
return _(self.get_related_type().capitalize()) return ugettext(self.get_related_type().capitalize())
def get_title(self): def get_title(self):
""" """
@ -77,6 +77,18 @@ class Item(MPTTModel, SlideMixin):
return self.title return self.title
return self.get_related_slide().get_agenda_title() return self.get_related_slide().get_agenda_title()
def get_title_supplement(self):
"""
return a supplement for the title.
"""
if self.related_sid is None:
return ''
try:
return self.get_related_slide().get_agenda_title_supplement()
except AttributeError:
return '(%s)' % self.print_related_type()
def slide(self): def slide(self):
""" """
Return a map with all Data for the Slide Return a map with all Data for the Slide

View File

@ -21,16 +21,7 @@
<div class="dragcell"></div> <div class="dragcell"></div>
{% endif %} {% endif %}
<a href="{% model_url item 'view' %}">{{ item }}</a> <a href="{% model_url item 'view' %}">{{ item }}</a>
{% if item.get_related_type == 'application' %} {{ item.get_title_supplement|safe }}
({% trans 'Application' %}
{% if item.get_related_slide.number %}
{{ item.get_related_slide.number }})
{% else %}
<i>[{% trans "no number" %}]</i>)
{% endif %}
{% elif item.related_sid %}
({{ item.print_related_type }})
{% endif %}
</td> </td>
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage_agenda %}
<td> <td>

View File

@ -18,7 +18,7 @@ from django.db import models
from django.db.models import Max from django.db.models import Max
from django.dispatch import receiver from django.dispatch import receiver
from django.utils.translation import pgettext from django.utils.translation import pgettext
from django.utils.translation import ugettext_lazy as _, ugettext_noop from django.utils.translation import ugettext_lazy as _, ugettext_noop, ugettext
from openslides.utils.utils import _propper_unicode from openslides.utils.utils import _propper_unicode
@ -436,6 +436,10 @@ class Application(models.Model, SlideMixin):
def get_agenda_title(self): def get_agenda_title(self):
return self.public_version.title return self.public_version.title
def get_agenda_title_supplement(self):
number = self.number or '<i>[%s]</i>' % ugettext('no number')
return '(%s %s)' % (ugettext('Application'), number)
def __getattr__(self, name): def __getattr__(self, name):
""" """
if name is title, text, reason or time, if name is title, text, reason or time,