OpenSlides/openslides/topics/serializers.py
FinnStutzenstein 44ed866210 fixes #3173
2017-03-31 12:28:13 +02:00

19 lines
482 B
Python

from openslides.utils.rest_api import ModelSerializer
from openslides.utils.validate import validate_html
from .models import Topic
class TopicSerializer(ModelSerializer):
"""
Serializer for core.models.Topic objects.
"""
class Meta:
model = Topic
fields = ('id', 'title', 'text', 'attachments', 'agenda_item_id')
def validate(self, data):
if 'text' in data:
data['text'] = validate_html(data['text'])
return data