f03b41f6fdbf043436fcd431402d82c02f065a12,app/server/views.py,AnnotationsAPI,post,#AnnotationsAPI#Any#,163

Before Change


        doc_id = self.kwargs["doc_id"]
        label_id = request.data["label_id"]
        doc = Document.objects.get(id=doc_id)
        label = Label.objects.get(id=label_id)
        annotation = DocumentAnnotation(document=doc, label=label, manual=True, user=self.request.user)
        annotation.save()
        serializer = self.serializer_class(annotation)

After Change



    def post(self, request, *args, **kwargs):
        doc = get_object_or_404(Document, pk=self.kwargs["doc_id"])
        label = get_object_or_404(Label, pk=request.data["label_id"])
        project = get_object_or_404(Project, pk=self.kwargs["project_id"])
        if project.is_type_of(Project.DOCUMENT_CLASSIFICATION):
            self.serializer_class = DocumentAnnotationSerializer
            annotation = DocumentAnnotation(document=doc, label=label, manual=True,
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: chakki-works/doccano
Commit Name: f03b41f6fdbf043436fcd431402d82c02f065a12
Time: 2018-07-05
Author: light.tree.1.13@gmail.com
File Name: app/server/views.py
Class Name: AnnotationsAPI
Method Name: post


Project Name: polyaxon/polyaxon
Commit Name: dc7751de09b71544eea14c4a06cf4753cf45f7c9
Time: 2019-03-18
Author: mouradmourafiq@gmail.com
File Name: polyaxon/api/endpoint/tensorboard.py
Class Name: TensorboardResourceListEndpoint
Method Name: _initialize_context


Project Name: polyaxon/polyaxon
Commit Name: 453971421835490972d920c354100e57326b31bd
Time: 2018-06-26
Author: mouradmourafiq@gmail.com
File Name: polyaxon/api/repos/views.py
Class Name: DownloadFilesView
Method Name: get_object