You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the permission_required decorator as follows:
@permission_required('perm_name', fn=objectgetter(model_name, view_arg)),
it is not possible to leverage default argument values as specified in the view declaration.
If for example, I declare my view as follows:
def edit_circle(request, cid=0):
...
When the view is called without the 'cid' argument, the following exception is raised:
ImproperlyConfigured: Argument cid is not available. Given arguments: []
The text was updated successfully, but these errors were encountered:
I just hit this too. I'll also solve it with a custom function, but it would be handy to have this built in. Typical use case is this: A single view that is used for both create and edit of an object. With a passed in ID, edits existing, without, creates new. No special permissions needed for new, but one can only edit their own existing objects. That's a fairly common pattern, no?
When using the permission_required decorator as follows:
@permission_required('perm_name', fn=objectgetter(model_name, view_arg)),
it is not possible to leverage default argument values as specified in the view declaration.
If for example, I declare my view as follows:
def edit_circle(request, cid=0):
...
When the view is called without the 'cid' argument, the following exception is raised:
ImproperlyConfigured: Argument cid is not available. Given arguments: []
The text was updated successfully, but these errors were encountered: