Reputation: 736
cursor.execute("SELECT DISTINCT User.name,Person.id,Person.firstName,Person.lastName,User.tokenHash from User JOIN Person ON User.personId = Parkloco.Person.id WHERE User.name = '%s' AND User.enabled = 1 " % username)
fields = map(lambda x: x[0], cursor.description)
result = [dict(zip(fields, row)) for row in cursor.fetchall()]
Response['X-Auth'] = result.tokenHash
return Response(result,status=status.HTTP_201_CREATED)
How to Parse Response Header in django.
Upvotes: 0
Views: 67
Reputation: 338
You can always send headers in Response as an argument and pass the header object like this
header = { X-Auth: result.tokenHash }
return Response(result, status=status.HTTP_201_CREATED, headers=header)
Also you can get more information about the Django Response here.
Hope that solves your problem.
Upvotes: 1