From ff4529d8ebe390ca8428ca17629a0671c30c5562 Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Fri, 20 Jul 2012 11:22:09 +0200 Subject: [PATCH] #315 remove application from agenda by appending a new methode get_application_title_supplement --- openslides/agenda/models.py | 16 ++++++++++++++-- openslides/agenda/templates/agenda/item_row.html | 11 +---------- openslides/application/models.py | 6 +++++- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/openslides/agenda/models.py b/openslides/agenda/models.py index 32ec36a0b..cd67de1a6 100644 --- a/openslides/agenda/models.py +++ b/openslides/agenda/models.py @@ -18,7 +18,7 @@ except ImportError: from django.db import models 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 @@ -67,7 +67,7 @@ class Item(MPTTModel, SlideMixin): For use in Template ??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): """ @@ -77,6 +77,18 @@ class Item(MPTTModel, SlideMixin): return self.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): """ Return a map with all Data for the Slide diff --git a/openslides/agenda/templates/agenda/item_row.html b/openslides/agenda/templates/agenda/item_row.html index a318fb96a..a198f6bae 100644 --- a/openslides/agenda/templates/agenda/item_row.html +++ b/openslides/agenda/templates/agenda/item_row.html @@ -21,16 +21,7 @@
{% endif %} {{ item }} - {% if item.get_related_type == 'application' %} - ({% trans 'Application' %} - {% if item.get_related_slide.number %} - {{ item.get_related_slide.number }}) - {% else %} - [{% trans "no number" %}]) - {% endif %} - {% elif item.related_sid %} - ({{ item.print_related_type }}) - {% endif %} + {{ item.get_title_supplement|safe }} {% if perms.agenda.can_manage_agenda %} diff --git a/openslides/application/models.py b/openslides/application/models.py index 911b4fb84..912bb436a 100644 --- a/openslides/application/models.py +++ b/openslides/application/models.py @@ -18,7 +18,7 @@ from django.db import models from django.db.models import Max from django.dispatch import receiver 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 @@ -436,6 +436,10 @@ class Application(models.Model, SlideMixin): def get_agenda_title(self): return self.public_version.title + def get_agenda_title_supplement(self): + number = self.number or '[%s]' % ugettext('no number') + return '(%s %s)' % (ugettext('Application'), number) + def __getattr__(self, name): """ if name is title, text, reason or time,