Horje
how do i check if a django queryset is empty Code Example
how do i check if a django queryset is empty
queryset = demo.objects.filter(name="non_existent_name")

if queryset.exists():
    serializer = DemoSerializer(queryset, many=True)
    return Response(serializer.data)
else:
    return Response(status=status.HTTP_404_NOT_FOUND)




Python

Related
py how to deactivate venv Code Example py how to deactivate venv Code Example
py exe tkinter Code Example py exe tkinter Code Example
python file location path Code Example python file location path Code Example
Binary Search tree implementation in python Code Example Binary Search tree implementation in python Code Example
csv reader python skip header Code Example csv reader python skip header Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7