Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to make api check multiple status using drf

def put(self, request, *args, **kwargs):
        data = request.data
        ticket_ids = [i['ticket_id'] for i in data]
        self.validate_ids(ticket_ids)
        instances = []
        for temp_dict in data:
            ticket_id = temp_dict['ticket_id']
            name = temp_dict['name']
            description = temp_dict['description']
            obj = self.get_object(ticket_id)
            obj.name = name
            obj.description = description
            obj.save()
            instances.append(obj)
        serializer = DemoSerializer(instances, many=True)
        return Response(serializer.data)
Comment

PREVIOUS NEXT
Code Example
Python :: add constant to all values of columns in dataframe python 
Python :: variable types in python 
Python :: pytest rerun last failed 
Python :: cython could not creat pyd file no such file or directory 
Python :: how to code a discord bot in python nextcord 
Python :: sort vs sorted python 
Python :: python record screen and audio 
Python :: type operator in python 
Python :: django get without exception 
Python :: numpy how to apply interpolation all rows 
Python :: How to count a consecutive series of positive or negative values in a column in python 
Python :: ORing two cv mat objects 
Python :: comprehension list iloc pandas 
Python :: pandas show head and tail 
Python :: who is bayceee roblox id 
Python :: installing intelpython3_core using anaconda 
Python :: pyhton how to chnge colour of graphs 
Python :: extract label from tf data 
Python :: how many perfect squared lie between 1 and 400 
Python :: fetch member by id discord.py 
Python :: auto instagram login 
Python :: scipy get frequencies of image 
Python :: Django pull from Google Sheets 
Python :: Python docx title 
Python :: How can I use Apache Spark with notebook in Anaconda 
Python :: djago get settings 
Python :: django database specify schema 
Python :: can we put the object as value in a dictionary in python* 
Python :: for _ in range python 
Python :: perfect power function python 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =