oscarmlage / django-cruds-adminlte

django-cruds is simple drop-in django app that creates CRUD for faster prototyping
BSD 3-Clause "New" or "Revised" License
424 stars 83 forks source link

create and update view for selected users #62

Closed igabice closed 6 years ago

igabice commented 6 years ago

hello, how can i make create and update view available for specific users only? I really don't understand how adding permission to a model's metadata works.

oscarmlage commented 6 years ago

@igabice I guess it would be nice for the community (and the upcoming users) if you add a little comment about how do you manage to resolve this. Thanks in advance.

igabice commented 6 years ago

to solve this i wrapped the edit button in list.html file with an if statement that checks if the current user is staff(i.e request.user.is_staff) before making the button visible. so only users who belong to the staff group can see the edit button .