how to write Query Parameters In Django

This is for freshers like me, Those who are strugle with how send data based on Request query params in django.

TYPE-1:
http://localhost:8000/api/abscs/?id=2

userid = request.query_params.get("userid")

result is saved on userid= "2"

TYEP-2:

http://127.0.0.1:8000/aAF/?status=omn&status=aad

which will correctly give you ['omn','aad'] when you use request.GET.getlist('status')





Comments

Popular posts from this blog

ERR: error parsing query: found influx, expected SELECT, DELETE, SHOW, CREATE, DROP, EXPLAIN, GRANT, REVOKE, ALTER, SET, KILL at line

How to get Full URL or get absolute url In Django

How To Convert Html File/URL/String Into Image Using Python