eed5c59013
Added api for groups. Refactored serializers now using 'id' instead of 'url'. Rework of tornado autoupdate functionality. Implemented extra data in SockJS messages.
26 lines
595 B
Python
26 lines
595 B
Python
from openslides.utils.rest_api import serializers
|
|
|
|
from .models import Mediafile
|
|
|
|
|
|
class MediafileSerializer(serializers.ModelSerializer):
|
|
"""
|
|
Serializer for mediafile.models.Mediafile objects.
|
|
"""
|
|
filesize = serializers.SerializerMethodField()
|
|
|
|
class Meta:
|
|
model = Mediafile
|
|
fields = (
|
|
'id',
|
|
'title',
|
|
'mediafile',
|
|
'uploader',
|
|
'filesize',
|
|
'filetype',
|
|
'timestamp',
|
|
'is_presentable',)
|
|
|
|
def get_filesize(self, mediafile):
|
|
return mediafile.get_filesize()
|