File tree Expand file tree Collapse file tree 3 files changed +6
-23
lines changed Expand file tree Collapse file tree 3 files changed +6
-23
lines changed Original file line number Diff line number Diff line change @@ -34,16 +34,6 @@ GET https://api.example.org/accounts/?page=4&limit=100
3434
3535# Permissions
3636
37- ## DjangoModelPermissions
38-
39- Add `` view `` permission control.
40-
41- Usage:
42-
43- ```
44- from djangorestframework_ext.permissions import DjangoModelPermissions
45- ```
46-
4737## IsCurrentUser
4838
4939Determine whether the object is the current login user.
Original file line number Diff line number Diff line change 1- from rest_framework import permissions
1+ from rest_framework . permissions import BasePermission
22
33
4- class DjangoModelPermissions (permissions .DjangoModelPermissions ):
5- def __init__ (self ):
6- self .perms_map ['GET' ] = ['%(app_label)s.view_%(model_name)s' ]
7- self .perms_map ['OPTIONS' ] = ['%(app_label)s.view_%(model_name)s' ]
8- self .perms_map ['HEAD' ] = ['%(app_label)s.view_%(model_name)s' ]
9-
10-
11- class IsCurrentUser (permissions .BasePermission ):
4+ class IsCurrentUser (BasePermission ):
125 def has_object_permission (self , request , view , obj ):
136 return obj == request .user
147
158
16- class IsSuperuser (permissions . BasePermission ):
9+ class IsSuperuser (BasePermission ):
1710 def has_permission (self , request , view ):
1811 return bool (request .user and request .user .is_superuser )
1912
2013
21- class ExportPermission (permissions . BasePermission ):
14+ class ExportPermission (BasePermission ):
2215 def has_permission (self , request , view ):
2316 if view .action == 'export' :
2417 model = view .get_queryset ().model
Original file line number Diff line number Diff line change 88
99setup (
1010 name = 'djangorestframework-ext' ,
11- version = '0.19 ' ,
11+ version = '0.20 ' ,
1212 url = 'https://github.com/zengqiu/django-rest-framework-ext' ,
1313 license = 'MIT' ,
1414 author = 'zengqiu' ,
1818 long_description_content_type = 'text/markdown' ,
1919 packages = find_packages (),
2020 platforms = 'any' ,
21- install_requires = ['django>=3.2' , 'djangorestframework>=3.10.0 ' ],
21+ install_requires = ['django>=3.2' , 'djangorestframework>=3.15 ' ],
2222 python_requires = '>=3.5' ,
2323 classifiers = [
2424 'Development Status :: 5 - Production/Stable' ,
You can’t perform that action at this time.
0 commit comments