7406183a0c7ca72f202a0e8b6f132e90bdbf21c7,app/server/views.py,DataDownloadAPI,get,#DataDownloadAPI#Any#,98

Before Change


class DataDownloadAPI(View):

    def get(self, request, *args, **kwargs):
        annotated_docs = [a.as_dict() for a in Annotation.objects.filter(manual=True)]
        json_str = json.dumps(annotated_docs)
        response = HttpResponse(json_str, content_type="application/json")
        response["Content-Disposition"] = "attachment; filename=annotation_data.json"

After Change


    def get(self, request, *args, **kwargs):
        project_id = self.kwargs["project_id"]
        project = get_object_or_404(Project, pk=project_id)
        docs = project.get_documents(is_null=False).distinct()
        response = HttpResponse(content_type="text/csv")
        response["Content-Disposition"] = "attachment; filename="{}.csv"".format(project.name)

        writer = csv.writer(response)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: chakki-works/doccano
Commit Name: 7406183a0c7ca72f202a0e8b6f132e90bdbf21c7
Time: 2018-08-02
Author: hiroki.nakayama.py@gmail.com
File Name: app/server/views.py
Class Name: DataDownloadAPI
Method Name: get


Project Name: comic/grand-challenge.org
Commit Name: 9dc8207fab1b78424fb0d81f63aebf943da19cc4
Time: 2020-06-08
Author: HarmvZ@users.noreply.github.com
File Name: app/grandchallenge/retina_api/views.py
Class Name: ArchiveAPIView
Method Name: get


Project Name: comic/grand-challenge.org
Commit Name: e044dcf3cb3f63c577e35ccee57c3d1253b6294f
Time: 2020-09-10
Author: 12661555+jmsmkn@users.noreply.github.com
File Name: app/grandchallenge/profiles/views.py
Class Name: UserProfileDetail
Method Name: get_context_data