'How to reference GET data in a POST request?
I am writing a POST request where a user tags a picture, therefore an instance of the Tagging table should be created. The picture is sent to the user through the GET request. How to I access for example the resource object that was sent through the GET request in the POST request so that I assign a Tag to a specific resource?
This is what I have tried so far:
views.py
if not isinstance(request.user, CustomUser):
current_user_id = 1
else:
current_user_id = request.user.pk
random_resource = request.GET.data.get('resource')
tag = request.data.get('tag')
created = datetime.now()
language = request.data.get('language')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|