<s> from rest_framework import serializers <EOL> from workshops . models import ( <EOL> Badge , <EOL> Airport , <EOL> Person , <EOL> Event , <EOL> TodoItem , <EOL> Tag , <EOL> Host , <EOL> Task , <EOL> Award , <EOL> ) <EOL> class AwardPersonSerializer ( serializers . ModelSerializer ) : <EOL> name = serializers . CharField ( source = '<STR_LIT>' ) <EOL> user = serializers . CharField ( source = '<STR_LIT>' ) <EOL> class Meta : <EOL> model = Award <EOL> fields = ( '<STR_LIT:name>' , '<STR_LIT:user>' , '<STR_LIT>' ) <EOL> class PersonUsernameSerializer ( serializers . ModelSerializer ) : <EOL> name = serializers . CharField ( source = '<STR_LIT>' ) <EOL> user = serializers . CharField ( source = '<STR_LIT:username>' ) <EOL> class Meta : <EOL> model = Person <EOL> fields = ( '<STR_LIT:name>' , '<STR_LIT:user>' , ) <EOL> class PersonNameEmailUsernameSerializer ( serializers . ModelSerializer ) : <EOL> name = serializers . CharField ( source = '<STR_LIT>' ) <EOL> class Meta : <EOL> model = Person <EOL> fields = ( '<STR_LIT:name>' , '<STR_LIT:email>' , '<STR_LIT:username>' ) <EOL> class ExportBadgesSerializer ( serializers . ModelSerializer ) : <EOL> persons = AwardPersonSerializer ( many = True , source = '<STR_LIT>' ) <EOL> class Meta : <EOL> model = Badge <EOL> fields = ( '<STR_LIT:name>' , '<STR_LIT>' ) <EOL> class ExportInstructorLocationsSerializer ( serializers . ModelSerializer ) : <EOL> name = serializers . CharField ( source = '<STR_LIT>' ) <EOL> instructors = PersonUsernameSerializer ( many = True , source = '<STR_LIT>' ) <EOL> class Meta : <EOL> model = Airport <EOL> fields = ( '<STR_LIT:name>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> class TagSerializer ( serializers . ModelSerializer ) : <EOL> class Meta : <EOL> model = Tag <EOL> fields = ( '<STR_LIT:name>' , ) <EOL> class ExportEventSerializer ( serializers . ModelSerializer ) : <EOL> humandate = serializers . CharField ( source = '<STR_LIT>' ) <EOL> country = serializers . CharField ( ) <EOL> start = serializers . DateField ( format = None ) <EOL> end = serializers . DateField ( format = None ) <EOL> url = serializers . URLField ( source = '<STR_LIT>' ) <EOL> eventbrite_id = serializers . CharField ( source = '<STR_LIT>' ) <EOL> tags = TagSerializer ( many = True ) <EOL> class Meta : <EOL> model = Event <EOL> fields = ( <EOL> '<STR_LIT>' , '<STR_LIT:start>' , '<STR_LIT:end>' , '<STR_LIT:url>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT:address>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ) <EOL> class TimelineTodoSerializer ( serializers . ModelSerializer ) : <EOL> content = serializers . SerializerMethodField ( ) <EOL> start = serializers . DateField ( format = None , source = '<STR_LIT>' ) <EOL> class Meta : <EOL> model = TodoItem <EOL> fields = ( <EOL> '<STR_LIT:content>' , '<STR_LIT:start>' , <EOL> ) <EOL> def get_content ( self , obj ) : <EOL> """<STR_LIT>""" <EOL> return '<STR_LIT>' . format ( <EOL> url = obj . event . get_absolute_url ( ) , <EOL> event = obj . event . get_ident ( ) , <EOL> todo = obj . title , <EOL> ) <EOL> class WorkshopsOverTimeSerializer ( serializers . Serializer ) : <EOL> date = serializers . DateField ( format = None , source = '<STR_LIT:start>' ) <EOL> count = serializers . IntegerField ( ) <EOL> class InstructorsOverTimeSerializer ( serializers . Serializer ) : <EOL> date = serializers . DateField ( format = None , source = '<STR_LIT>' ) <EOL> count = serializers . IntegerField ( ) <EOL> class InstructorNumTaughtSerializer ( serializers . Serializer ) : <EOL> person = serializers . HyperlinkedRelatedField ( <EOL> read_only = True , view_name = '<STR_LIT>' , lookup_field = '<STR_LIT>' , <EOL> source = '<STR_LIT:*>' ) <EOL> name = serializers . CharField ( source = '<STR_LIT>' ) <EOL> num_taught = serializers . IntegerField ( ) <EOL> class InstructorsByTimePeriodSerializer ( serializers . ModelSerializer ) : <EOL> event_slug = serializers . CharField ( source = '<STR_LIT>' ) <EOL> person_name = serializers . CharField ( source = '<STR_LIT>' ) <EOL> person_email = serializers . EmailField ( source = '<STR_LIT>' ) <EOL> num_taught = serializers . SerializerMethodField ( ) <EOL> class Meta : <EOL> model = Task <EOL> fields = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> def get_num_taught ( self , obj ) : <EOL> """<STR_LIT>""" <EOL> return obj . person . task_set . instructors ( ) . count ( ) <EOL> class HostSerializer ( serializers . ModelSerializer ) : <EOL> country = serializers . CharField ( ) <EOL> class Meta : <EOL> model = Host <EOL> fields = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> class AirportSerializer ( serializers . ModelSerializer ) : <EOL> country = serializers . CharField ( ) <EOL> class Meta : <EOL> model = Airport <EOL> fields = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> class AwardSerializer ( serializers . ModelSerializer ) : <EOL> badge = serializers . SlugRelatedField ( <EOL> many = False , read_only = True , slug_field = '<STR_LIT:name>' ) <EOL> event = serializers . HyperlinkedRelatedField ( <EOL> read_only = True , view_name = '<STR_LIT>' , lookup_field = '<STR_LIT>' ) <EOL> class Meta : <EOL> model = Award <EOL> fields = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> class PersonSerializer ( serializers . ModelSerializer ) : <EOL> airport = serializers . HyperlinkedRelatedField ( <EOL> read_only = True , view_name = '<STR_LIT>' , lookup_field = '<STR_LIT>' ) <EOL> lessons = serializers . SlugRelatedField ( <EOL> many = True , read_only = True , slug_field = '<STR_LIT:name>' ) <EOL> domains = serializers . SlugRelatedField ( <EOL> many = True , read_only = True , slug_field = '<STR_LIT:name>' ) <EOL> badges = serializers . SlugRelatedField ( <EOL> many = True , read_only = True , slug_field = '<STR_LIT:name>' ) <EOL> awards = serializers . HyperlinkedIdentityField ( <EOL> view_name = '<STR_LIT>' , <EOL> lookup_field = '<STR_LIT>' , <EOL> lookup_url_kwarg = '<STR_LIT>' , <EOL> ) <EOL> tasks = serializers . HyperlinkedIdentityField ( <EOL> view_name = '<STR_LIT>' , <EOL> lookup_field = '<STR_LIT>' , <EOL> lookup_url_kwarg = '<STR_LIT>' , <EOL> ) <EOL> class Meta : <EOL> model = Person <EOL> fields = ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:email>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:url>' , '<STR_LIT:username>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> ) <EOL> class TaskSerializer ( serializers . ModelSerializer ) : <EOL> event = serializers . HyperlinkedRelatedField ( <EOL> read_only = True , view_name = '<STR_LIT>' , lookup_field = '<STR_LIT>' ) <EOL> person = serializers . HyperlinkedRelatedField ( <EOL> read_only = True , view_name = '<STR_LIT>' ) <EOL> role = serializers . SlugRelatedField ( <EOL> many = False , read_only = True , slug_field = '<STR_LIT:name>' ) <EOL> class Meta : <EOL> model = Task <EOL> fields = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> class TodoSerializer ( serializers . ModelSerializer ) : <EOL> class Meta : <EOL> model = TodoItem <EOL> fields = ( '<STR_LIT>' , '<STR_LIT:title>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> class EventSerializer ( serializers . ModelSerializer ) : <EOL> country = serializers . CharField ( ) <EOL> start = serializers . DateField ( format = None ) <EOL> end = serializers . DateField ( format = None ) <EOL> host = serializers . HyperlinkedRelatedField ( <EOL> read_only = True , view_name = '<STR_LIT>' , lookup_field = '<STR_LIT>' ) <EOL> administrator = serializers . HyperlinkedRelatedField ( <EOL> read_only = True , view_name = '<STR_LIT>' , lookup_field = '<STR_LIT>' ) <EOL> tags = serializers . SlugRelatedField ( <EOL> many = True , read_only = True , slug_field = '<STR_LIT:name>' ) <EOL> tasks = serializers . HyperlinkedIdentityField ( <EOL> view_name = '<STR_LIT>' , <EOL> lookup_field = '<STR_LIT>' , <EOL> lookup_url_kwarg = '<STR_LIT>' , <EOL> ) <EOL> todos = serializers . HyperlinkedIdentityField ( <EOL> view_name = '<STR_LIT>' , <EOL> lookup_field = '<STR_LIT>' , <EOL> lookup_url_kwarg = '<STR_LIT>' , <EOL> source = '<STR_LIT>' , <EOL> ) <EOL> assigned_to = serializers . HyperlinkedRelatedField ( <EOL> read_only = True , view_name = '<STR_LIT>' ) <EOL> class Meta : <EOL> model = Event <EOL> fields = ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:start>' , '<STR_LIT:end>' , '<STR_LIT:host>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:address>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> ) </s>
