Skip to content

Commit

Permalink
redirects dashboard URL to profile info page when profile is not a pr…
Browse files Browse the repository at this point in the history
…ovider

This enables simplification of links generated for the dynamic menubar item
for authenticated users.
  • Loading branch information
smirolo committed Oct 25, 2024
1 parent 44fedb2 commit 5f8f6ff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down Expand Up @@ -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 $@


Expand Down
8 changes: 7 additions & 1 deletion saas/views/profile.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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):
"""
Expand Down

0 comments on commit 5f8f6ff

Please sign in to comment.