From 5f8f6ff3a951a59c8bc7ef047a5cb8c1bfdc6b04 Mon Sep 17 00:00:00 2001 From: Sebastien Mirolo Date: Fri, 25 Oct 2024 12:09:25 -0700 Subject: [PATCH] redirects dashboard URL to profile info page when profile is not a provider This enables simplification of links generated for the dynamic menubar item for authenticated users. --- Makefile | 13 +++++++------ saas/views/profile.py | 8 +++++++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index abb71461..80bacbf4 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ PIP := pip SQLITE := sqlite3 TWINE := twine +ASSETS_DIR := $(srcDir)/testsite/static DB_NAME ?= $(RUN_DIR)/db.sqlite $(info Path to python executable (i.e. PYTHON) while running make: $(shell which $(PYTHON))) @@ -110,12 +111,12 @@ $(DESTDIR)$(CONFIG_DIR)/gunicorn.conf: $(srcDir)/testsite/etc/gunicorn.conf $(libDir)/.npm/djaodjin-saas-packages: $(srcDir)/testsite/package.json $(installFiles) $^ $(libDir) $(NPM) install --loglevel verbose --cache $(libDir)/.npm --prefix $(libDir) - $(installDirs) -d $(srcDir)/testsite/static/vendor - $(installFiles) $(libDir)/node_modules/jquery/dist/jquery.js $(srcDir)/testsite/static/vendor - $(installFiles) $(libDir)/node_modules/moment/moment.js $(srcDir)/testsite/static/vendor - $(installFiles) $(libDir)/node_modules/moment-timezone/builds/moment-timezone-with-data.js $(srcDir)/testsite/static/vendor - $(installFiles) $(libDir)/node_modules/vue/dist/vue.js $(srcDir)/testsite/static/vendor - $(installFiles) $(libDir)/node_modules/vue-croppa/dist/vue-croppa.js $(srcDir)/testsite/static/vendor + $(installDirs) -d $(ASSETS_DIR)/vendor + $(installFiles) $(libDir)/node_modules/jquery/dist/jquery.js $(ASSETS_DIR)/vendor + $(installFiles) $(libDir)/node_modules/moment/moment.js $(ASSETS_DIR)/vendor + $(installFiles) $(libDir)/node_modules/moment-timezone/builds/moment-timezone-with-data.js $(ASSETS_DIR)/vendor + $(installFiles) $(libDir)/node_modules/vue/dist/vue.js $(ASSETS_DIR)/vendor + $(installFiles) $(libDir)/node_modules/vue-croppa/dist/vue-croppa.js $(ASSETS_DIR)/vendor touch $@ diff --git a/saas/views/profile.py b/saas/views/profile.py index 0a144edf..d2e2af0f 100644 --- a/saas/views/profile.py +++ b/saas/views/profile.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021, DjaoDjin inc. +# Copyright (c) 2024, DjaoDjin inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -377,6 +377,12 @@ def get_context_data(self, **kwargs): def get_object(self, queryset=None): return self.organization + def get(self, request, *args, **kwargs): + if not self.organization.is_provider: + return http.HttpResponseRedirect( + reverse('saas_organization_profile', args=(self.organization,))) + return super(DashboardView, self).get(request, *args, **kwargs) + class OrganizationProfileView(OrganizationMixin, UpdateView): """