This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Disables the child attach listener so that inflated children with wrap_content heights can pass. | |
| * | |
| * This is very fragile and depends on the implementation details of [ViewPager2]. | |
| * | |
| * @see ViewPager2.enforceChildFillListener (the removed listener) | |
| */ | |
| private fun ViewPager2.hackMatchParentCheckInViewPager() { | |
| (getChildAt(0) as RecyclerView).clearOnChildAttachStateChangeListeners() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from rest_framework.permissions import BasePermission, SAFE_METHODS | |
| class IsAdminOrReadOnly(BasePermission): | |
| def has_permission(self, request, view): | |
| if request.method in SAFE_METHODS: | |
| return True | |
| else: | |
| return request.user.is_staff |