From a4e6e42d34096c3d9f2d594c9e8d3a1feca6fa33 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Sat, 20 Jan 2024 15:53:10 +0100 Subject: [PATCH] fix duplicated functions --- idhub/mixins.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/idhub/mixins.py b/idhub/mixins.py index f101f0e..b2b3fbe 100644 --- a/idhub/mixins.py +++ b/idhub/mixins.py @@ -29,28 +29,18 @@ class UserView(LoginRequiredMixin): ] def get(self, request, *args, **kwargs): + self.admin_validated = cache.get("KEY_DIDS") response = super().get(request, *args, **kwargs) url = self.check_gdpr() - if url: - return url - return response + return url or response def post(self, request, *args, **kwargs): + self.admin_validated = cache.get("KEY_DIDS") response = super().post(request, *args, **kwargs) url = self.check_gdpr() - if url: - return url - return response - - def get(self, request, *args, **kwargs): - self.admin_validated = cache.get("KEY_DIDS") - return super().get(request, *args, **kwargs) - - def post(self, request, *args, **kwargs): - self.admin_validated = cache.get("KEY_DIDS") - return super().post(request, *args, **kwargs) + return url or response def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs)