For generic class based views we return information about the fields that are accepted for 'PUT' and 'POST' methods.
(self, request, view)
| 70 | return metadata |
| 71 | |
| 72 | def determine_actions(self, request, view): |
| 73 | """ |
| 74 | For generic class based views we return information about |
| 75 | the fields that are accepted for 'PUT' and 'POST' methods. |
| 76 | """ |
| 77 | actions = {} |
| 78 | for method in {'PUT', 'POST'} & set(view.allowed_methods): |
| 79 | view.request = clone_request(request, method) |
| 80 | try: |
| 81 | # Test global permissions |
| 82 | if hasattr(view, 'check_permissions'): |
| 83 | view.check_permissions(view.request) |
| 84 | # Test object permissions |
| 85 | if method == 'PUT' and hasattr(view, 'get_object'): |
| 86 | view.get_object() |
| 87 | except (exceptions.APIException, PermissionDenied, Http404): |
| 88 | pass |
| 89 | else: |
| 90 | # If user has appropriate permissions for the view, include |
| 91 | # appropriate metadata about the fields that should be supplied. |
| 92 | serializer = view.get_serializer() |
| 93 | actions[method] = self.get_serializer_info(serializer) |
| 94 | finally: |
| 95 | view.request = request |
| 96 | |
| 97 | return actions |
| 98 | |
| 99 | def get_serializer_info(self, serializer): |
| 100 | """ |
no test coverage detected