'List a Project\'s Releases
Retrieve a list of releases for a given project.
:pparam string organization_slug: the slug of the organization the
release belongs to.
:pparam string project_slug: the slug of the project to list the
releases of.
:qparam string query: this parameter can be used to create a
"starts with" filter for the version.'

def get(self, request, project):

    query = request.GET.get('query')
    queryset = Release.objects.filter(projects=project, organization_id=project.organization_id).select_related('owner')
    if query:
        queryset = queryset.filter(version__istartswith=query)
    queryset = queryset.extra(select={'sort': 'COALESCE(date_released,    date_added)'})
    return self.paginate(request=request, queryset=queryset, order_by='-sort', paginator_cls=OffsetPaginator, on_results=(lambda x: serialize(x, request.user, project=project)))
