Skip to content

Commit

Permalink
feat: [ACI-986] redirect to template page on requirement/penalty save
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrii committed May 20, 2024
1 parent ece7c9a commit 8cca846
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion credentials/apps/badges/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Admin section configuration.
"""

from django.conf import settings
from django.contrib import admin, messages
from django.contrib.sites.shortcuts import get_current_site
from django.core.management import call_command
Expand Down Expand Up @@ -387,6 +386,11 @@ def template_link(self, instance):

template_link.short_description = _("badge template")

def response_change(self, request, obj):
if "_save" in request.POST:
return HttpResponseRedirect(reverse("admin:badges_credlybadgetemplate_change", args=[obj.template.pk]))
return super().response_change(request, obj)


class BadgePenaltyAdmin(admin.ModelAdmin):
"""
Expand Down Expand Up @@ -456,6 +460,11 @@ def template_link(self, instance):

template_link.short_description = _("badge template")

def response_change(self, request, obj):
if "_save" in request.POST:
return HttpResponseRedirect(reverse("admin:badges_credlybadgetemplate_change", args=[obj.template.pk]))
return super().response_change(request, obj)


class BadgeProgressAdmin(admin.ModelAdmin):
"""
Expand Down

0 comments on commit 8cca846

Please sign in to comment.