Commit 5a195774 authored by Mark Steadman's avatar Mark Steadman

Adds model information to the auth bundle when creating a new object

parent 4f0e5c2d
......@@ -208,6 +208,20 @@ class ModelViewBase(
class ListView(ModelViewBase):
def get_auth_bundle_data(self):
Returns a dictionary of data used to construct an
:class:`~authorisation.AuthBundle` object. Inlcudes an `object`
key which represents the Django model object the user wants to
interact with.
data = super().get_auth_bundle_data()
obj = self.get_resource()
data['model'] = obj.model
return data
def dispatch(self, request, *args, **kwargs):
......@@ -370,7 +384,9 @@ class DetailView(ModelViewBase):
data = super().get_auth_bundle_data()
data['object'] = self.get_resource().get_object()
obj = self.get_resource().get_object()
data['object'] = obj
data['model'] = type(obj)
return data
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment