Best Python code snippet using autotest_python
utils.py
Source:utils.py  
1# -*- coding: utf-8 -*-2# This Source Code Form is subject to the terms of the Mozilla Public3# License, v. 2.0. If a copy of the MPL was not distributed with this4# file, You can obtain one at http://mozilla.org/MPL/2.0/.5#6# Copyright (c) 2021-present Kaleidos Ventures SL7def attach_members(queryset, as_field="members_attr"):8    """Attach a json members representation to each object of the queryset.9    :param queryset: A Django projects queryset object.10    :param as_field: Attach the members as an attribute with this name.11    :return: Queryset object with the additional `as_field` field.12    """13    model = queryset.model14    sql = """15             SELECT json_agg(row_to_json(t))16              FROM  (17                        SELECT users_user.id,18                               users_user.username,19                               users_user.full_name,20                               users_user.email,21                               concat(full_name, username) complete_user_name,22                               users_user.color,23                               users_user.photo,24                               users_user.is_active,25                               users_role.id "role",26                               users_role.name role_name27                          FROM projects_membership28                     LEFT JOIN users_user ON projects_membership.user_id = users_user.id29                     LEFT JOIN users_role ON users_role.id = projects_membership.role_id30                         WHERE projects_membership.project_id = {tbl}.id31                      ORDER BY complete_user_name32                    ) t33          """34    sql = sql.format(tbl=model._meta.db_table)35    queryset = queryset.extra(select={as_field: sql})36    return queryset37def attach_milestones(queryset, as_field="milestones_attr"):38    """Attach a json milestons representation to each object of the queryset.39    :param queryset: A Django projects queryset object.40    :param as_field: Attach the milestones as an attribute with this name.41    :return: Queryset object with the additional `as_field` field.42    """43    model = queryset.model44    sql = """45             SELECT json_agg(row_to_json(t))46               FROM (47                        SELECT milestones_milestone.id,48                               milestones_milestone.slug,49                               milestones_milestone.name,50                               milestones_milestone.closed51                          FROM milestones_milestone52                         WHERE milestones_milestone.project_id = {tbl}.id53                      ORDER BY estimated_start54                    ) t55          """56    sql = sql.format(tbl=model._meta.db_table)57    queryset = queryset.extra(select={as_field: sql})58    return queryset59def attach_closed_milestones(queryset, as_field="closed_milestones_attr"):60    """Attach a closed milestones counter to each object of the queryset.61    :param queryset: A Django projects queryset object.62    :param as_field: Attach the counter as an attribute with this name.63    :return: Queryset object with the additional `as_field` field.64    """65    model = queryset.model66    sql = """67             SELECT COUNT(milestones_milestone.id)68               FROM milestones_milestone69              WHERE milestones_milestone.project_id = {tbl}.id AND70                    milestones_milestone.closed = True71          """72    sql = sql.format(tbl=model._meta.db_table)73    queryset = queryset.extra(select={as_field: sql})74    return queryset75def attach_notify_policies(queryset, as_field="notify_policies_attr"):76    """Attach a json notification policies representation to each object of the queryset.77    :param queryset: A Django projects queryset object.78    :param as_field: Attach the notification policies as an attribute with this name.79    :return: Queryset object with the additional `as_field` field.80    """81    model = queryset.model82    sql = """83             SELECT json_agg(row_to_json(notifications_notifypolicy))84               FROM notifications_notifypolicy85              WHERE notifications_notifypolicy.project_id = {tbl}.id86          """87    sql = sql.format(tbl=model._meta.db_table)88    queryset = queryset.extra(select={as_field: sql})89    return queryset90def attach_epic_statuses(queryset, as_field="epic_statuses_attr"):91    """Attach a json epic statuses representation to each object of the queryset.92    :param queryset: A Django projects queryset object.93    :param as_field: Attach the epic statuses as an attribute with this name.94    :return: Queryset object with the additional `as_field` field.95    """96    model = queryset.model97    sql = """98             SELECT json_agg(99                        row_to_json(projects_epicstatus)100                        ORDER BY projects_epicstatus.order101                    )102               FROM projects_epicstatus103              WHERE projects_epicstatus.project_id = {tbl}.id104          """105    sql = sql.format(tbl=model._meta.db_table)106    queryset = queryset.extra(select={as_field: sql})107    return queryset108def attach_swimlanes(queryset, as_field="swimlanes_attr"):109    """Attach a json swimlanes representation to each object of the queryset.110    :param queryset: A Django projects queryset object.111    :param as_field: Attach the swimalne as an attribute with this name.112    :return: Queryset object with the additional `as_field` field.113    """114    model = queryset.model115    sql = """116             SELECT json_agg(117                        row_to_json(projects_swimlane)118                        ORDER BY projects_swimlane.order119                    )120               FROM projects_swimlane121              WHERE projects_swimlane.project_id = {tbl}.id122          """123    sql = sql.format(tbl=model._meta.db_table)124    queryset = queryset.extra(select={as_field: sql})125    return queryset126def attach_userstory_statuses(queryset, as_field="userstory_statuses_attr"):127    """Attach a json userstory statuses representation to each object of the queryset.128    :param queryset: A Django projects queryset object.129    :param as_field: Attach the userstory statuses as an attribute with this name.130    :return: Queryset object with the additional `as_field` field.131    """132    model = queryset.model133    sql = """134             SELECT json_agg(135                        row_to_json(projects_userstorystatus)136                        ORDER BY projects_userstorystatus.order137                    )138               FROM projects_userstorystatus139              WHERE projects_userstorystatus.project_id = {tbl}.id140          """141    sql = sql.format(tbl=model._meta.db_table)142    queryset = queryset.extra(select={as_field: sql})143    return queryset144def attach_userstory_duedates(queryset, as_field="userstory_duedates_attr"):145    """Attach a json userstory duedates representation to each object of the queryset.146    :param queryset: A Django projects queryset object.147    :param as_field: Attach the userstory duedates as an attribute with this name.148    :return: Queryset object with the additional `as_field` field.149    """150    model = queryset.model151    sql = """152             SELECT json_agg(153                        row_to_json(projects_userstoryduedate)154                        ORDER BY projects_userstoryduedate.order155                    )156               FROM projects_userstoryduedate157              WHERE projects_userstoryduedate.project_id = {tbl}.id158          """159    sql = sql.format(tbl=model._meta.db_table)160    queryset = queryset.extra(select={as_field: sql})161    return queryset162def attach_points(queryset, as_field="points_attr"):163    """Attach a json points representation to each object of the queryset.164    :param queryset: A Django projects queryset object.165    :param as_field: Attach the points as an attribute with this name.166    :return: Queryset object with the additional `as_field` field.167    """168    model = queryset.model169    sql = """170             SELECT json_agg(171                        row_to_json(projects_points)172                        ORDER BY projects_points.order173                    )174               FROM projects_points175              WHERE projects_points.project_id = {tbl}.id176                """177    sql = sql.format(tbl=model._meta.db_table)178    queryset = queryset.extra(select={as_field: sql})179    return queryset180def attach_task_statuses(queryset, as_field="task_statuses_attr"):181    """Attach a json task statuses representation to each object of the queryset.182    :param queryset: A Django projects queryset object.183    :param as_field: Attach the task statuses as an attribute with this name.184    :return: Queryset object with the additional `as_field` field.185    """186    model = queryset.model187    sql = """188             SELECT json_agg(189                        row_to_json(projects_taskstatus)190                        ORDER BY projects_taskstatus.order191                    )192               FROM projects_taskstatus193              WHERE projects_taskstatus.project_id = {tbl}.id194          """195    sql = sql.format(tbl=model._meta.db_table)196    queryset = queryset.extra(select={as_field: sql})197    return queryset198def attach_task_duedates(queryset, as_field="task_duedates_attr"):199    """Attach a json task duedates representation to each object of the queryset.200    :param queryset: A Django projects queryset object.201    :param as_field: Attach the task duedates as an attribute with this name.202    :return: Queryset object with the additional `as_field` field.203    """204    model = queryset.model205    sql = """206             SELECT json_agg(207                        row_to_json(projects_taskduedate)208                        ORDER BY projects_taskduedate.order209                    )210               FROM projects_taskduedate211              WHERE projects_taskduedate.project_id = {tbl}.id212          """213    sql = sql.format(tbl=model._meta.db_table)214    queryset = queryset.extra(select={as_field: sql})215    return queryset216def attach_issue_statuses(queryset, as_field="issue_statuses_attr"):217    """Attach a json issue statuses representation to each object of the queryset.218    :param queryset: A Django projects queryset object.219    :param as_field: Attach the statuses as an attribute with this name.220    :return: Queryset object with the additional `as_field` field.221    """222    model = queryset.model223    sql = """224             SELECT json_agg(225                        row_to_json(projects_issuestatus)226                        ORDER BY projects_issuestatus.order227                    )228               FROM projects_issuestatus229              WHERE projects_issuestatus.project_id = {tbl}.id230          """231    sql = sql.format(tbl=model._meta.db_table)232    queryset = queryset.extra(select={as_field: sql})233    return queryset234def attach_issue_types(queryset, as_field="issue_types_attr"):235    """Attach a json issue types representation to each object of the queryset.236    :param queryset: A Django projects queryset object.237    :param as_field: Attach the types as an attribute with this name.238    :return: Queryset object with the additional `as_field` field.239    """240    model = queryset.model241    sql = """242             SELECT json_agg(243                        row_to_json(projects_issuetype)244                        ORDER BY projects_issuetype.order245                    )246               FROM projects_issuetype247              WHERE projects_issuetype.project_id = {tbl}.id248          """249    sql = sql.format(tbl=model._meta.db_table)250    queryset = queryset.extra(select={as_field: sql})251    return queryset252def attach_issue_duedates(queryset, as_field="issue_duedates_attr"):253    """Attach a json issue duedates representation to each object of the queryset.254    :param queryset: A Django projects queryset object.255    :param as_field: Attach the duedates as an attribute with this name.256    :return: Queryset object with the additional `as_field` field.257    """258    model = queryset.model259    sql = """260             SELECT json_agg(261                        row_to_json(projects_issueduedate)262                        ORDER BY projects_issueduedate.order263                    )264               FROM projects_issueduedate265              WHERE projects_issueduedate.project_id = {tbl}.id266          """267    sql = sql.format(tbl=model._meta.db_table)268    queryset = queryset.extra(select={as_field: sql})269    return queryset270def attach_priorities(queryset, as_field="priorities_attr"):271    """Attach a json priorities representation to each object of the queryset.272    :param queryset: A Django projects queryset object.273    :param as_field: Attach the priorities as an attribute with this name.274    :return: Queryset object with the additional `as_field` field.275    """276    model = queryset.model277    sql = """278             SELECT json_agg(279                        row_to_json(projects_priority)280                        ORDER BY projects_priority.order281                    )282               FROM projects_priority283              WHERE projects_priority.project_id = {tbl}.id284          """285    sql = sql.format(tbl=model._meta.db_table)286    queryset = queryset.extra(select={as_field: sql})287    return queryset288def attach_severities(queryset, as_field="severities_attr"):289    """Attach a json severities representation to each object of the queryset.290    :param queryset: A Django projects queryset object.291    :param as_field: Attach the severities as an attribute with this name.292    :return: Queryset object with the additional `as_field` field.293    """294    model = queryset.model295    sql = """296             SELECT json_agg(297                        row_to_json(projects_severity)298                        ORDER BY projects_severity.order299                    )300               FROM projects_severity301              WHERE projects_severity.project_id = {tbl}.id302          """303    sql = sql.format(tbl=model._meta.db_table)304    queryset = queryset.extra(select={as_field: sql})305    return queryset306def attach_epic_custom_attributes(queryset, as_field="epic_custom_attributes_attr"):307    """Attach a json epic custom attributes representation to each object of the queryset.308    :param queryset: A Django projects queryset object.309    :param as_field: Attach the epic custom attributes as an attribute with this name.310    :return: Queryset object with the additional `as_field` field.311    """312    model = queryset.model313    sql = """314             SELECT json_agg(315                        row_to_json(custom_attributes_epiccustomattribute)316                        ORDER BY custom_attributes_epiccustomattribute.order317                    )318               FROM custom_attributes_epiccustomattribute319              WHERE custom_attributes_epiccustomattribute.project_id = {tbl}.id320          """321    sql = sql.format(tbl=model._meta.db_table)322    queryset = queryset.extra(select={as_field: sql})323    return queryset324def attach_userstory_custom_attributes(queryset, as_field="userstory_custom_attributes_attr"):325    """Attach a json userstory custom attributes representation to each object of the queryset.326    :param queryset: A Django projects queryset object.327    :param as_field: Attach the userstory custom attributes as an attribute with this name.328    :return: Queryset object with the additional `as_field` field.329    """330    model = queryset.model331    sql = """332             SELECT json_agg(333                        row_to_json(custom_attributes_userstorycustomattribute)334                        ORDER BY custom_attributes_userstorycustomattribute.order335                    )336               FROM custom_attributes_userstorycustomattribute337              WHERE custom_attributes_userstorycustomattribute.project_id = {tbl}.id338          """339    sql = sql.format(tbl=model._meta.db_table)340    queryset = queryset.extra(select={as_field: sql})341    return queryset342def attach_task_custom_attributes(queryset, as_field="task_custom_attributes_attr"):343    """Attach a json task custom attributes representation to each object of the queryset.344    :param queryset: A Django projects queryset object.345    :param as_field: Attach the task custom attributes as an attribute with this name.346    :return: Queryset object with the additional `as_field` field.347    """348    model = queryset.model349    sql = """350             SELECT json_agg(351                        row_to_json(custom_attributes_taskcustomattribute)352                        ORDER BY custom_attributes_taskcustomattribute.order353                    )354               FROM custom_attributes_taskcustomattribute355              WHERE custom_attributes_taskcustomattribute.project_id = {tbl}.id356          """357    sql = sql.format(tbl=model._meta.db_table)358    queryset = queryset.extra(select={as_field: sql})359    return queryset360def attach_issue_custom_attributes(queryset, as_field="issue_custom_attributes_attr"):361    """Attach a json issue custom attributes representation to each object of the queryset.362    :param queryset: A Django projects queryset object.363    :param as_field: Attach the issue custom attributes as an attribute with this name.364    :return: Queryset object with the additional `as_field` field.365    """366    model = queryset.model367    sql = """368             SELECT json_agg(369                        row_to_json(custom_attributes_issuecustomattribute)370                        ORDER BY custom_attributes_issuecustomattribute.order371                    )372               FROM custom_attributes_issuecustomattribute373              WHERE custom_attributes_issuecustomattribute.project_id = {tbl}.id374          """375    sql = sql.format(tbl=model._meta.db_table)376    queryset = queryset.extra(select={as_field: sql})377    return queryset378def attach_roles(queryset, as_field="roles_attr"):379    """Attach a json roles representation to each object of the queryset.380    :param queryset: A Django projects queryset object.381    :param as_field: Attach the roles as an attribute with this name.382    :return: Queryset object with the additional `as_field` field.383    """384    model = queryset.model385    sql = """386             SELECT json_agg(387                        row_to_json(users_role)388                        ORDER BY users_role.order389                    )390               FROM users_role391              WHERE users_role.project_id = {tbl}.id392          """393    sql = sql.format(tbl=model._meta.db_table)394    queryset = queryset.extra(select={as_field: sql})395    return queryset396def attach_is_fan(queryset, user, as_field="is_fan_attr"):397    """Attach a is fan boolean to each object of the queryset.398    :param queryset: A Django projects queryset object.399    :param as_field: Attach the boolean as an attribute with this name.400    :return: Queryset object with the additional `as_field` field.401    """402    model = queryset.model403    if user is None or user.is_anonymous:404        sql = "SELECT false"405    else:406        sql = """407                 SELECT COUNT(likes_like.id) > 0408                   FROM likes_like409             INNER JOIN django_content_type ON likes_like.content_type_id = django_content_type.id410                  WHERE django_content_type.model = 'project' AND411                        django_content_type.app_label = 'projects' AND412                        likes_like.user_id = {user_id} AND413                        likes_like.object_id = {tbl}.id414              """415        sql = sql.format(tbl=model._meta.db_table, user_id=user.id)416    queryset = queryset.extra(select={as_field: sql})417    return queryset418def attach_my_role_permissions(queryset, user, as_field="my_role_permissions_attr"):419    """Attach a permission array to each object of the queryset.420    :param queryset: A Django projects queryset object.421    :param as_field: Attach the permissions as an attribute with this name.422    :return: Queryset object with the additional `as_field` field.423    """424    model = queryset.model425    if user is None or user.is_anonymous:426        sql = "SELECT '{}'"427    else:428        sql = """429                 SELECT users_role.permissions430                   FROM projects_membership431              LEFT JOIN users_user ON projects_membership.user_id = users_user.id432              LEFT JOIN users_role ON users_role.id = projects_membership.role_id433                  WHERE projects_membership.project_id = {tbl}.id AND434                        users_user.id = {user_id}"""435        sql = sql.format(tbl=model._meta.db_table, user_id=user.id)436    queryset = queryset.extra(select={as_field: sql})437    return queryset438def attach_my_homepage(queryset, user, as_field="my_homepage_attr"):439    """Attach a homepage array to each object of the queryset.440    :param queryset: A Django projects queryset object.441    :param as_field: Attach the settings homepage as an attribute with this name.442    :return: Queryset object with the additional `as_field` field.443    """444    model = queryset.model445    if user is None or user.is_anonymous:446        sql = "SELECT '{}'"447    else:448        sql = """449                 SELECT homepage450                   FROM settings_userprojectsettings451                  WHERE settings_userprojectsettings.project_id = {tbl}.id AND452                        settings_userprojectsettings.user_id = {user_id}"""453        sql = sql.format(tbl=model._meta.db_table, user_id=user.id)454    queryset = queryset.extra(select={as_field: sql})455    return queryset456def attach_extra_info(queryset, user=None):457    queryset = attach_members(queryset)458    queryset = attach_closed_milestones(queryset)459    queryset = attach_notify_policies(queryset)460    queryset = attach_epic_statuses(queryset)461    queryset = attach_swimlanes(queryset)462    queryset = attach_userstory_statuses(queryset)463    queryset = attach_userstory_duedates(queryset)464    queryset = attach_points(queryset)465    queryset = attach_task_statuses(queryset)466    queryset = attach_task_duedates(queryset)467    queryset = attach_issue_statuses(queryset)468    queryset = attach_issue_duedates(queryset)469    queryset = attach_issue_types(queryset)470    queryset = attach_priorities(queryset)471    queryset = attach_severities(queryset)472    queryset = attach_epic_custom_attributes(queryset)473    queryset = attach_userstory_custom_attributes(queryset)474    queryset = attach_task_custom_attributes(queryset)475    queryset = attach_issue_custom_attributes(queryset)476    queryset = attach_roles(queryset)477    queryset = attach_is_fan(queryset, user)478    queryset = attach_my_role_permissions(queryset, user)479    queryset = attach_milestones(queryset)480    queryset = attach_my_homepage(queryset, user)481    return queryset482def attach_basic_info(queryset, user=None):483    """Attach basic information to each object of the queryset. It's a conservative approach,484    could be reduced in future versions.485    :param queryset: A Django projects queryset object.486    :return: Queryset487    """488    queryset = attach_members(queryset)489    queryset = attach_notify_policies(queryset)490    queryset = attach_is_fan(queryset, user)491    queryset = attach_my_role_permissions(queryset, user)492    queryset = attach_my_homepage(queryset, user)...views.py
Source:views.py  
1from rest_framework.response import Response2from rest_framework.views import APIView3from rest_framework.generics import ListAPIView, RetrieveAPIView4from rest_framework import permissions5from .models import Listing6from .serializers import ListingSerializer, ListingDetailSerializer7from datetime import datetime, timezone, timedelta8import re9from rest_framework.parsers import JSONParser10class ListingsView(ListAPIView):11    queryset = Listing.objects.filter(is_published = True).order_by('-list_date')12    permission_classes = (permissions.AllowAny, )13    serializer_class = ListingSerializer14    lookup_field = 'slug'15class ListingDetailView(RetrieveAPIView):16    queryset = Listing.objects.filter(is_published=True).order_by('-list_date')17    serializer_class = ListingDetailSerializer18    lookup_field = 'slug'19class SearchView(APIView):20    permission_classes = (permissions.AllowAny,)21    serializer_class = ListingSerializer22    # parser_classes = [JSONParser]23    def post(self, request , format = None):24        data = request.data25        print(data)26        queryset = Listing.objects.filter( is_published=True).order_by('-list_date')27        28        sale_type = data['sale_type']29        queryset = queryset.filter(sale_type__iexact=sale_type)30        price = data['price']31        try:32            price = int(re.findall('\d+',price)[0])33        except:34            price = -135        if price != -1:36            queryset = queryset.filter(price__gte=price)37        38        39        bedrooms = data['bedrooms']40        try:41            bedrooms = int(re.findall('\d+', bedrooms)[0])42        except:43            bedrooms =044        45        queryset = queryset.filter(bedrooms__gte=bedrooms)46        home_type = data['home_type']47        queryset = queryset.filter(home_type__iexact=home_type)48        bathrooms = data['bathrooms']49        try:50            bathrooms = float(re.findall('\d+', bathrooms)[0])51        except:52            bathrooms = 0.053        54        queryset = queryset.filter(bathrooms__gte=bathrooms)55        sqft = data['sqft']56        try:57            sqft = float(re.findall('\d+', sqft)[0])58        except:59            sqft = 060      61        62        if sqft != 0:63            queryset = queryset.filter(sqft__gte=sqft)64        days_passed = data['days_listed']65        try:66            days_passed = int(re.findall('\d+', days_passed)[0])67        except:68            days_passed = 069       70        for query in queryset:71            num_days = (datetime.now(timezone.utc) - query.list_date).days72            if days_passed != 0:73                if num_days > days_passed:74                    slug=query.slug75                    queryset = queryset.exclude(slug__iexact=slug)76 77        has_photos = data['has_photos']78        try:79            has_photos = int(re.findall('\d+', has_photos)[0])80        except:81            has_photos =182      83        for query in queryset:84            count = query.getListingPhotosCount85            if count < has_photos:86                slug = query.slug87                queryset = queryset.exclude(slug__iexact=slug)88        open_house = str(data['open_house'])89        # print(f"open_house is {open_house}")90        # open_house = True if open_house == 'true' else  False91        queryset = queryset.filter(open_house__iexact = open_house)92        keywords = data['keywords']93        queryset = queryset.filter(description__icontains = keywords)94        serializer = ListingDetailSerializer(queryset, many=True)...project_index.py
Source:project_index.py  
1from __future__ import absolute_import2import six3from django.db.models import Q4from sentry.api.base import DocSection, Endpoint5from sentry.api.bases.project import ProjectPermission6from sentry.api.paginator import DateTimePaginator7from sentry.api.serializers import serialize, ProjectWithOrganizationSerializer8from sentry.db.models.query import in_iexact9from sentry.models import (10    Project, ProjectPlatform, ProjectStatus11)12from sentry.search.utils import tokenize_query13from sentry.utils.apidocs import scenario, attach_scenarios14@scenario('ListYourProjects')15def list_your_projects_scenario(runner):16    runner.request(17        method='GET',18        path='/projects/'19    )20class ProjectIndexEndpoint(Endpoint):21    doc_section = DocSection.PROJECTS22    permission_classes = (ProjectPermission,)23    @attach_scenarios([list_your_projects_scenario])24    def get(self, request):25        """26        List your Projects27        ``````````````````28        Return a list of projects available to the authenticated29        session.30        :auth: required31        """32        queryset = Project.objects.select_related('organization').distinct()33        status = request.GET.get('status', 'active')34        if status == 'active':35            queryset = queryset.filter(36                status=ProjectStatus.VISIBLE,37            )38        elif status == 'deleted':39            queryset = queryset.exclude(40                status=ProjectStatus.VISIBLE,41            )42        elif status:43            queryset = queryset.none()44        if request.auth and not request.user.is_authenticated():45            if hasattr(request.auth, 'project'):46                queryset = queryset.filter(47                    id=request.auth.project_id,48                )49            elif request.auth.organization is not None:50                queryset = queryset.filter(51                    organization=request.auth.organization.id,52                )53            else:54                queryset = queryset.none()55        elif not request.is_superuser():56            queryset = queryset.filter(57                team__organizationmember__user=request.user,58            )59        query = request.GET.get('query')60        if query:61            tokens = tokenize_query(query)62            for key, value in six.iteritems(tokens):63                if key == 'query':64                    value = ' '.join(value)65                    queryset = queryset.filter(66                        Q(name__icontains=value) |67                        Q(slug__icontains=value)68                    )69                elif key == 'slug':70                    queryset = queryset.filter(71                        in_iexact('slug', value)72                    )73                elif key == 'name':74                    queryset = queryset.filter(75                        in_iexact('name', value)76                    )77                elif key == 'platform':78                    queryset = queryset.filter(79                        id__in=ProjectPlatform.objects.filter(80                            platform__in=value,81                        ).values('project_id')82                    )83                elif key == 'id':84                    queryset = queryset.filter(id__in=value)85        return self.paginate(86            request=request,87            queryset=queryset,88            order_by='-date_added',89            on_results=lambda x: serialize(x, request.user, ProjectWithOrganizationSerializer()),90            paginator_cls=DateTimePaginator,...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
