From 12a27ba01e60468e581a36325e6aeae9181be02d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Sun, 16 Aug 2020 13:43:35 +0800 Subject: [PATCH] Simplified the get_object method in the AccountFormView in the accounting application. --- accounting/views.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/accounting/views.py b/accounting/views.py index 0ca4425..bf13693 100644 --- a/accounting/views.py +++ b/accounting/views.py @@ -988,9 +988,7 @@ class AccountFormView(FormView): def get_object(self) -> Optional[Account]: """Returns the current object, or None on a create form.""" - if "account" in self.kwargs: - return self.kwargs["account"] - return None + return self.kwargs.get("account") @require_POST