[Answer]-Getting 'GET' parameter in views.py

1👍

Your problem seems to be here: legislation_id = request.GET.id

request.GET is a dictionary so you need to get its key like this:

legislation_id = request.GET["id"]

You can also get the key with dict‘s get method as @Alvaro suggested: request.GET.get("id", 0). This will return 0 as default if id key ain’t present and save you from KeyError exception.

Hope this helps!

Leave a comment