poulpe/api/event/serializers.py

13 lines
438 B
Python
Raw Normal View History

2017-07-18 17:48:59 +02:00
from rest_framework import serializers
from event.models import Event
from django.contrib.auth import get_user_model
class EventSerializer(serializers.HyperlinkedModelSerializer):
created_by = serializers.ReadOnlyField(source='created_by.username')
class Meta:
model = Event
fields = ('url', 'id', 'title', 'slug', 'created_by', 'creation_date',
'description', 'begining_date', 'ending_date')