diff --git a/PyRIGS/decorators.py b/PyRIGS/decorators.py index ca7cd8ea..fe7d1825 100644 --- a/PyRIGS/decorators.py +++ b/PyRIGS/decorators.py @@ -79,7 +79,9 @@ def api_key_required(function): """ Decorator for views that checks api_pk and api_key. Failed users will be given a 403 error. - Should only be used for urls which include and kwargs + Should only be used for urls which include and kwargs. + + Will update the kwargs to include the user object if successful (under the key 'user'). """ def wrap(request, *args, **kwargs): @@ -97,6 +99,7 @@ def api_key_required(function): try: user_object = models.Profile.objects.get(pk=userid) + kwargs = {**kwargs, 'user': user_object} except models.Profile.DoesNotExist: return error_resp