Page serialization

Page serialization matches our Page structure. Pages endpoints are always parameterized using an election day.

Cycle pages

Serializers

class theshow.serializers.ElectionDaySerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)
get_bodies(obj)

Bodies with offices up for election on election day.

get_executive_offices(obj)

Executive offices up for election on election day.

get_special_elections(obj)

States holding a special election on election day.

get_states(obj)

States holding a non-special election on election day.

Viewsets

class theshow.viewsets.ElectionDayList(**kwargs)
class theshow.viewsets.ElectionDayDetail(**kwargs)

State pages

Serializers

class theshow.serializers.StateListSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)
class theshow.serializers.StateSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)
get_content(obj)

All content for a state’s page on an election day.

get_division(obj)

Division.

get_elections(obj)

All elections in division.

get_parties(obj)

All parties.

Viewsets

class theshow.viewsets.StateMixin
get_queryset()

Returns a queryset of all states holding a non-special election on a date.

get_serializer_context()

Adds election_day to serializer context.

class theshow.viewsets.StateList(**kwargs)
class theshow.viewsets.StateDetail(**kwargs)

Body pages

Serializers

class theshow.serializers.BodyListSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)
class theshow.serializers.BodySerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)
get_content(obj)

All content for body’s page on an election day.

get_division(obj)

Division.

get_elections(obj)

All elections held on an election day.

get_parties(obj)

All parties.

Viewsets

class theshow.viewsets.BodyMixin
get_queryset()

Returns a queryset of all bodies holding an election on a date.

get_serializer_context()

Adds election_day to serializer context.

class theshow.viewsets.BodyList(**kwargs)
class theshow.viewsets.BodyDetail(**kwargs)

Office pages

Serializers

class theshow.serializers.OfficeListSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)
class theshow.serializers.OfficeSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)
get_content(obj)

All content for office’s page on an election day.

get_division(obj)

Division.

get_elections(obj)

All elections on an election day.

get_parties(obj)

All parties.

Viewsets

class theshow.viewsets.OfficeMixin
get_queryset()

Returns a queryset of all executive offices holding an election on a date.

get_serializer_context()

Adds election_day to serializer context.

class theshow.viewsets.OfficeList(**kwargs)
class theshow.viewsets.OfficeDetail(**kwargs)