d30b4142d1f9c6b6d43868dadd2f452be724ed1b,doccano/app/server/views.py,SearchAPI,get,#SearchAPI#Any#,80

Before Change


            docs = [{"id": None, "labels": [], "text": ""}]
        // Annotation.objects.select_related("data").all().filter(data__text__contains=keyword)

        return JsonResponse({"data": docs})


class LabelAPI(View):

After Change


        paginator = Paginator(docs, 5)
        page = request.GET.get("page", 1)
        page = paginator.get_page(page)
        docs = page.object_list

        return JsonResponse({"data": docs,
                             "has_next": page.has_next(),
                             "has_previous": page.has_previous(),
                             "previous_page_number": page.previous_page_number() if page.has_previous() else None,
                             "next_page_number": page.next_page_number() if page.has_next() else None})


class LabelAPI(View):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: chakki-works/doccano
Commit Name: d30b4142d1f9c6b6d43868dadd2f452be724ed1b
Time: 2018-06-17
Author: light.tree.1.13@gmail.com
File Name: doccano/app/server/views.py
Class Name: SearchAPI
Method Name: get


Project Name: comic/grand-challenge.org
Commit Name: e1ec03165b1f47fac773a977ca6b1d18abb8463d
Time: 2018-03-13
Author: jamesmeakin@gmail.com
File Name: app/uploads/views.py
Class Name: CKUploadView
Method Name: form_valid


Project Name: jazzband/django-debug-toolbar
Commit Name: af0d5af82a29ae39955331be6ca50b575b7b1466
Time: 2020-05-19
Author: jon.dufresne@gmail.com
File Name: debug_toolbar/views.py
Class Name:
Method Name: render_panel