Solution thanks to Sk1p:
from django.contrib.auth.decorators import permission_required
ip_manager/urls.py:
urlpatterns = patterns('',
url(r'^(?P<groupname>\w+)/tag/add/$', permission_required('ip_manager.add_tag')(TagFormView.as_view()), name='tag-add'),
)
I am trying to restrict users from adding, changing, or deleting a model. I am using only CBVs. I have looked at the following examples..
and
How to use permission_required decorators on django class-based views
My problem is I want to tell which permission a user needs to access, but I am not sure how to specify it. I tried passing the permission as a arg in login-required and tested it on a user with no permissions set. This method did not work it still allowed me to add a new model object. Does any one have any suggestions?
ip_manager/urls.py:
urlpatterns = patterns('',
url(r'^(?P<groupname>\w+)/tag/add/$', login_required(TagFormView.as_view(), 'ip_manager.add_tag'), name='tag-add'),
)
Thanks, Ryan