Created
May 18, 2019 02:38
-
-
Save chrisguox/4de1a0cc586055d776be818ed636cf6e to your computer and use it in GitHub Desktop.
This file contains 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
class ResponseMixin: | |
@property | |
def _base_result_dict(): | |
result_dict = { | |
'res': 'Test' | |
} | |
return result_dict | |
class A(ResponseMixin, View): | |
def post(self, request, *args, **kwargs): | |
result_dict = self._base_result_dict | |
return JsonResponse(result_dict) | |
class B(ResponseMixin, View): | |
def post(self, request, *args, **kwargs): | |
result_dict = self._base_result_dict | |
res = result_dict.get("res") | |
result_dict["res"] = self._logic(res) | |
return JsonResponse(result_dict) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment