I have a special Django admin action called "run_test".
I would like to start that action from a Jenkins job on some items.
Something like this was my idea
import json
import requests
url = "http://localhost:8000/admin/app/model/"
item = { "user": "jenkins",
"password": "password",
"action": "run_test",
"index": 0
}
headers = {"Content-Type":"application/json","Accept": "application/json"}
resp = requests.post(url,data=json.dumps(item),headers=headers)
print(resp)
403 is the answer I got as a response.
Is there a way to run Django admin command with curl or request.post?
How can I include a queryset?
Note: manage.py command is not an option