def citation(self, request, accession_id, citation_id):

        if request.method == 'POST':
            stream = BytesIO(request.body)
            payload_data = JSONParser().parse(stream)
            citation = Citation.objects.get(pk=payload_data['id'])
            serializer = CitationSerializer(citation, data=payload_data)

            # Will raise/return status 400 if data is not valid.
            if serializer.is_valid(raise_exception=True):
                citation = serializer.save()

        else:
            citation = get_object_or_404(Citation, pk=citation_id)
        data = {'citation': CitationSerializer(citation).data}
        response_data = JSONRenderer().render(data)
        return HttpResponse(response_data, content_type='application/json')
DEPRECATED: use L{twisted.internet.threads.deferToThread} instead.
dataset/ETHPy150Open upconsulting/IsisCB/isiscb/zotero/admin.py/ImportAccessionAdmin.citation--crossover with--dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/python/threadpool.py/ThreadPool.dispatchWithCallback