mattrobenolt / mattrobenolt/django-sudo
Support for AJAX requests?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 279
- Forks
- 25
- PR merge metrics
- No merged PRs in 30d
Description
I have a case where I would like to use sudo access for a REST API, but it doesn't appear that this will work nicely with this framework currently.
What I would propose is basically an addition to the sudo_required decorator:
if request.is_ajax():
return HttpResponseForbidden(json.dumps({'message': 'Forbidden', 'sudo_required': True}), content_type='application/json')
There would also need to be a view which could receive an AJAX payload for authentication and return the appropriate cookie.
Is this something which would be in the scope of this project, or would it be more suited to something like a django-rest-framework-sudo package?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the sudo_required decorator and the view that handles sudo authentication. Review how request.is_ajax(), the proposed JSON 403 response, the AJAX payload, and the authentication cookie would fit together. The issue is done only after the project’s scope and the expected AJAX behavior are agreed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- api, authentication, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100