2015-01-24 16:35:50 +01:00
|
|
|
from openslides.utils.rest_api import serializers
|
2015-01-06 00:11:22 +01:00
|
|
|
|
|
|
|
from .models import User
|
|
|
|
|
|
|
|
|
2015-01-24 16:35:50 +01:00
|
|
|
class UserShortSerializer(serializers.ModelSerializer):
|
2015-01-06 00:11:22 +01:00
|
|
|
"""
|
2015-01-17 14:25:05 +01:00
|
|
|
Serializer for users.models.User objects.
|
|
|
|
|
|
|
|
Serializes only name fields.
|
2015-01-06 00:11:22 +01:00
|
|
|
"""
|
|
|
|
class Meta:
|
|
|
|
model = User
|
|
|
|
fields = (
|
2015-01-24 16:35:50 +01:00
|
|
|
'url',
|
2015-01-06 00:11:22 +01:00
|
|
|
'username',
|
2015-01-17 14:25:05 +01:00
|
|
|
'title',
|
2015-01-06 00:11:22 +01:00
|
|
|
'first_name',
|
2015-01-17 14:25:05 +01:00
|
|
|
'last_name',
|
|
|
|
'structure_level')
|
|
|
|
|
|
|
|
|
2015-01-24 16:35:50 +01:00
|
|
|
class UserFullSerializer(serializers.ModelSerializer):
|
2015-01-17 14:25:05 +01:00
|
|
|
"""
|
2015-01-17 14:25:05 +01:00
|
|
|
Serializer for users.models.User objects.
|
|
|
|
|
|
|
|
Serializes all relevant fields.
|
2015-01-17 14:25:05 +01:00
|
|
|
"""
|
|
|
|
class Meta:
|
|
|
|
model = User
|
|
|
|
fields = (
|
2015-01-24 16:35:50 +01:00
|
|
|
'url',
|
2015-01-17 14:25:05 +01:00
|
|
|
'is_present',
|
|
|
|
'username',
|
|
|
|
'title',
|
|
|
|
'first_name',
|
|
|
|
'last_name',
|
|
|
|
'structure_level',
|
|
|
|
'about_me',
|
|
|
|
'comment',
|
|
|
|
'default_password',
|
|
|
|
'is_active')
|