From 8a6ca904dc50da8641ada01fc1a380aa20769521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Sat, 9 Jan 2016 10:18:51 +0100 Subject: [PATCH] Added attachments to custom slides. --- CHANGELOG | 1 + .../0009_customslide_attachments.py | 20 +++++++++++++++++++ openslides/core/models.py | 5 +++++ openslides/core/serializers.py | 2 +- 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 openslides/core/migrations/0009_customslide_attachments.py diff --git a/CHANGELOG b/CHANGELOG index ba6ef1179..722590e96 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -13,6 +13,7 @@ Agenda: - Changed API of related objects. All assignments, motions and custom slides are now agenda items and can be hidden. - Removed mptt. +- Added attachments to custom slides. Assignments: - Renamed app from assignment to assignments. - Removed possibility to block candidates. diff --git a/openslides/core/migrations/0009_customslide_attachments.py b/openslides/core/migrations/0009_customslide_attachments.py new file mode 100644 index 000000000..5bc673e1a --- /dev/null +++ b/openslides/core/migrations/0009_customslide_attachments.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('mediafiles', '0004_auto_20151210_0016'), + ('core', '0008_auto_20151210_0016'), + ] + + operations = [ + migrations.AddField( + model_name='customslide', + name='attachments', + field=models.ManyToManyField(to='mediafiles.Mediafile', verbose_name='Attachments', blank=True), + ), + ] diff --git a/openslides/core/models.py b/openslides/core/models.py index 31e9c16f3..d51803f61 100644 --- a/openslides/core/models.py +++ b/openslides/core/models.py @@ -5,6 +5,7 @@ from django.db import models from django.utils.translation import ugettext_noop from jsonfield import JSONField +from openslides.mediafiles.models import Mediafile from openslides.utils.models import RESTModelMixin from openslides.utils.projector import ProjectorElement @@ -127,6 +128,10 @@ class CustomSlide(RESTModelMixin, models.Model): blank=True) weight = models.IntegerField( default=0) + attachments = models.ManyToManyField( + Mediafile, + verbose_name=ugettext_lazy('Attachments'), + blank=True) class Meta: default_permissions = () diff --git a/openslides/core/serializers.py b/openslides/core/serializers.py index 2622fe948..65e5133e3 100644 --- a/openslides/core/serializers.py +++ b/openslides/core/serializers.py @@ -39,7 +39,7 @@ class CustomSlideSerializer(ModelSerializer): """ class Meta: model = CustomSlide - fields = ('id', 'title', 'text', 'weight', 'agenda_item_id') + fields = ('id', 'title', 'text', 'weight', 'attachments', 'agenda_item_id') class TagSerializer(ModelSerializer):