Skip to content
Advertisement

Type error when trying to fetch data Python Django

I am trying to get data from the database based on request with id u_id and x_id but I am not getting any data instead getting an error TypeError: display_data() missing 2 required positional arguments: 'u_id' and 'x_id' can you help?

code

JavaScript

urls.py

JavaScript

Advertisement

Answer

You need to get them from the POST data instead.

JavaScript

Also, you might want to use a form for validation.

If you want to get u_id and x_id as arguments like you are trying, you need to add them to the url.

JavaScript

Edit: Use filter instead of get if you are getting multiple objects

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement