Comments (2)
As an example of a quick solution you can override save_form:
def save_form(self, request, form, change):
obj = super().save_form(request, form, change)
if not self._has_change_only_permission(request, obj):
raise PermissionDenied
return obj
from django-admin-view-permission.
Hi @Michaeljczhang,
Yes, you are true. You can click the button but nothing will happen. Django Modelform will remove the readonly fields from the form so when Django will try to execute form.save() nothing will happen as there are no changes.
Thanks,
Lefteris
from django-admin-view-permission.
Related Issues (20)
- Change 'Change' button text to 'View' on admin index page if user only has view perm for model HOT 2
- No logs for View permissions HOT 1
- Determine if current admin form is view-only in __init__ HOT 3
- Auth User password hash is shown in default UserAdmin HOT 1
- users and groups admin site HOT 1
- You don't have permission to edit anything at the admin page HOT 9
- Django 2.0 support HOT 6
- Deleting object using Action menu raises KeyError: 'cl' HOT 2
- Users with view permission cannot see custom action HOT 1
- Adding users via /admin/auth/user/add/ throws error because password field doesn't exist HOT 3
- KeyError in admin using add user HOT 1
- Do not work with many to many inlines
- Apply permissions to Customized AdminSite classes HOT 2
- KeyError at `admin details page url` u"Key 'slug' not found in 'ModelForm'. Choices are: ."
- Django 2.1 Error: django.db.utils.IntegrityError: UNIQUE constraint failed: auth_permission.content_type_id, auth_permission.codename HOT 3
- Users with "change" permissions see "delete selected" action in drop down HOT 2
- Management command missing
- request not present in args but in kwargs HOT 1
- Readme not quite accurate HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-admin-view-permission.