events.api.v1.viewsets package

Submodules

events.api.v1.viewsets.event_registrations module

class events.api.v1.viewsets.event_registrations.EventRegistrationViewSet(**kwargs)[source]

Bases: rest_framework.mixins.RetrieveModelMixin, rest_framework.mixins.UpdateModelMixin, rest_framework.viewsets.GenericViewSet

Defines the viewset for registrations, requires an authenticated user.

Has custom update and destroy methods that use the services.

basename = None
description = None
destroy(request, pk=None, **kwargs)[source]
detail = None
get_object()[source]

Returns the object the view is displaying.

You may want to override this if you need to provide non-standard queryset lookups. Eg if objects are referenced using multiple keyword arguments in the url conf.

get_serializer_context()[source]

Extra context provided to the serializer class.

name = None
perform_update(serializer)[source]
permission_classes = [<class 'rest_framework.permissions.IsAuthenticated'>]
queryset
serializer_class

alias of events.api.v1.serializers.event_registrations.list.EventRegistrationSerializer

suffix = None

events.api.v1.viewsets.events module

class events.api.v1.viewsets.events.EventViewset(**kwargs)[source]

Bases: rest_framework.viewsets.ReadOnlyModelViewSet

Define the viewset for events, requires an authenticated user and enables ordering on the event start/end.

basename = None
description = None
detail = None
filter_backends = (<class 'rest_framework.filters.OrderingFilter'>, <class 'rest_framework.filters.SearchFilter'>)
get_queryset()[source]

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

get_serializer_class()[source]

Return the class to use for the serializer. Defaults to using self.serializer_class.

You may want to override this if you need to provide different serializations depending on the incoming request.

(Eg. admins get full serialization, others get basic serialization)

name = None
ordering_fields = ('start', 'end')
permission_classes = [<class 'rest_framework.permissions.IsAuthenticatedOrReadOnly'>]
queryset
registrations(request, pk)[source]

Define a custom route for the event’s registrations, can filter on registration status if the user is an organiser.

Parameters
  • request – the request object

  • pk – the primary key of the event

Returns

the registrations of the event

search_fields = ('title_en',)
suffix = None