2016-09-18 22:14:24 +02:00
|
|
|
from openslides.utils.rest_api import ModelSerializer
|
2017-01-20 11:34:05 +01:00
|
|
|
from openslides.utils.validate import validate_html
|
2016-09-18 22:14:24 +02:00
|
|
|
|
|
|
|
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):
|
2017-03-28 08:27:54 +02:00
|
|
|
if 'text' in data:
|
2017-03-31 10:07:36 +02:00
|
|
|
data['text'] = validate_html(data['text'])
|
2017-01-20 11:34:05 +01:00
|
|
|
return data
|