Consider merging these comparisons with "in" to "'' in (username, password)"
474 def post(self, request, *args, **kwargs):
475 username = request.POST['username']
476 password = request.POST['password']
477 if username == "" or password == "":478 return Response(data="Empty Usename or Password Field.", status=400)
479
480 user = authenticate(request, username=username, password=password)
Description
To check if a variable is equal to one of many values, combine the values into a tuple and check if the variable is contained in
it instead of checking for equality against each of the values.
This is faster, less verbose, and more readable.
Bad practice
if x == 1 or x == 2 or x == 3:
do_something()
Recommended
if x in (1, 2, 3):
do_something()