OpenSlides/openslides/topics/serializers.py

18 lines
459 B
Python
Raw Normal View History

from openslides.utils.rest_api import ModelSerializer
2017-01-20 11:34:05 +01:00
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')
2017-01-20 11:34:05 +01:00
def validate(self, data):
data['text'] = validate_html(data.get('text', ''))
return data