diff --git a/openslides/agenda/models.py b/openslides/agenda/models.py index 72300d699..60395e730 100644 --- a/openslides/agenda/models.py +++ b/openslides/agenda/models.py @@ -31,10 +31,13 @@ class Item(MPTTModel, SlideMixin): """ prefix = 'item' + AGENDA_ITEM = 1 + ORGANIZATIONAL_ITEM = 2 + ITEM_TYPE = ( - ('agd', _('Agenda item')), - ('org', _('Organizational item')), - ) + (AGENDA_ITEM, _('Agenda item')), + (ORGANIZATIONAL_ITEM, _('Organizational item')), + ) title = models.CharField(null=True, max_length=255, verbose_name=_("Title")) text = models.TextField(null=True, blank=True, verbose_name=_("Text")) @@ -43,8 +46,8 @@ class Item(MPTTModel, SlideMixin): weight = models.IntegerField(default=0, verbose_name=_("Weight")) parent = TreeForeignKey('self', null=True, blank=True, related_name='children') - type = models.CharField(max_length=3, choices=ITEM_TYPE, - default='agd', verbose_name=_("Type")) + type = models.IntegerField(max_length=1, choices=ITEM_TYPE, + default=AGENDA_ITEM, verbose_name=_("Type")) duration = models.TimeField(blank=True, null=True, verbose_name=_("Duration (hh:mm)")); diff --git a/openslides/agenda/slides.py b/openslides/agenda/slides.py index f5b544b1d..51acb35c2 100644 --- a/openslides/agenda/slides.py +++ b/openslides/agenda/slides.py @@ -16,7 +16,7 @@ from django.utils.translation import ugettext as _ def agenda_show(): from openslides.agenda.models import Item data = {} - items = Item.objects.filter(parent=None, type__exact='agd') + items = Item.objects.filter(parent=None, type__exact=Item.AGENDA_ITEM) data['title'] = _("Agenda") data['items'] = items data['template'] = 'projector/AgendaSummary.html' diff --git a/openslides/agenda/templates/agenda/item_row.html b/openslides/agenda/templates/agenda/item_row.html index a7943b6cf..edadcdbe1 100644 --- a/openslides/agenda/templates/agenda/item_row.html +++ b/openslides/agenda/templates/agenda/item_row.html @@ -20,7 +20,7 @@ {% if perms.agenda.can_manage_agenda %}
{% endif %} - {% if item.type == "org" %}[{% endif %}{{ item }}{% if item.type == "org" %}]{% endif %} + {% if item.type == item.ORGANIZATIONAL_ITEM %}[{% endif %}{{ item }}{% if item.type == item.ORGANIZATIONAL_ITEM %}]{% endif %} {{ item.get_title_supplement|safe }} {% if perms.agenda.can_manage_agenda %} diff --git a/openslides/agenda/templates/agenda/widget.html b/openslides/agenda/templates/agenda/widget.html index e1b8644a7..32c44bca8 100644 --- a/openslides/agenda/templates/agenda/widget.html +++ b/openslides/agenda/templates/agenda/widget.html @@ -39,7 +39,7 @@ {% for p in item.get_ancestors %}   {% endfor %} - {% if item.type == "org" %}[{% endif %}{{ item }}{% if item.type == "org" %}]{% endif %} + {% if item.type == item.ORGANIZATIONAL_ITEM %}[{% endif %}{{ item }}{% if item.type == item.ORGANIZATIONAL_ITEM %}]{% endif %} {{ item.get_title_supplement|safe }} {% empty %} diff --git a/openslides/agenda/views.py b/openslides/agenda/views.py index 954868ba2..7ce1ca831 100644 --- a/openslides/agenda/views.py +++ b/openslides/agenda/views.py @@ -47,7 +47,7 @@ class Overview(TemplateView): if self.request.user.has_perm('agenda.can_see_orga_items'): items = Item.objects.all() else: - items = Item.objects.filter(type__exact = 'agd') + items = Item.objects.filter(type__exact=Item.AGENDA_ITEM) duration = timedelta() @@ -220,7 +220,7 @@ class AgendaPDF(PDFView): document_title = ugettext_lazy('Agenda') def append_to_pdf(self, story): - for item in Item.objects.filter(type__exact = 'agd'): + for item in Item.objects.filter(type__exact=Item.AGENDA_ITEM): ancestors = item.get_ancestors() if ancestors: space = " " * 6 * ancestors.count()