From bfbe9355550cf4b8c06a1eefdcdb3da2856528c9 Mon Sep 17 00:00:00 2001 From: Yoan Le Clanche Date: Thu, 24 Sep 2020 17:45:06 +0200 Subject: [PATCH] Add UI action to duplicate seminar : https://trackers.pilotsystems.net/probarreau/0931 --- teleforma/admin.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/teleforma/admin.py b/teleforma/admin.py index ef87b339..20daea7f 100644 --- a/teleforma/admin.py +++ b/teleforma/admin.py @@ -162,6 +162,16 @@ class SeminarAdmin(admin.ModelAdmin): ordering = ['course', 'rank'] search_fields = ['course__title', 'title', 'sub_title'] list_filter = ('period', 'publish_date', 'expiry_date') + actions = ['clone_seminars'] + + def clone_seminars(self, request, queryset): + log = "" + for seminar in queryset: + log += seminar.clone_to_next_year() + log += "\n" + return HttpResponse(log) + + clone_seminars.short_description = "Dupliquer les séminaires" class Media: css = { 'all': ('admin/extra.css',) } -- 2.39.5