From f2eb7b315f9fcd2fb9f63da448ea36667c27c1af Mon Sep 17 00:00:00 2001 From: sabinammm Date: Wed, 16 Mar 2022 14:57:31 +0100 Subject: [PATCH] euth/contrib: overwrite module django admin to redirect to project --- euth/contrib/admin.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 euth/contrib/admin.py diff --git a/euth/contrib/admin.py b/euth/contrib/admin.py new file mode 100644 index 000000000..355fc8fc4 --- /dev/null +++ b/euth/contrib/admin.py @@ -0,0 +1,15 @@ +from django.contrib import admin +from django.urls import reverse + +from adhocracy4.modules import models +from adhocracy4.modules.admin import ModuleAdmin as A4ModuleAdmin + + +class ModuleAdmin(A4ModuleAdmin): + + def view_on_site(self, obj): + return reverse('project-detail', args=[str(obj.project.slug)]) + + +admin.site.unregister(models.Module) +admin.site.register(models.Module, ModuleAdmin)