Skip to content

Commit

Permalink
feat(apis_entities): add info message to duplicated object
Browse files Browse the repository at this point in the history
Closes: #893
  • Loading branch information
b1rger committed Jun 24, 2024
1 parent c471255 commit c4dc573
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apis_core/apis_entities/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from django.contrib import messages
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.shortcuts import get_object_or_404, redirect
from django.urls import reverse
from django.utils.html import format_html
from django.views import View
from django.views.generic.edit import FormView

Expand All @@ -22,6 +24,14 @@ def get(self, request, *args, **kwargs):
source_obj = get_object_or_404(self.model, pk=kwargs["pk"])
newobj = source_obj.duplicate()

messages.success(
request,
format_html(
"<a href={}>{}</a> was successfully duplicated to the current object:",
source_obj.get_absolute_url(),
source_obj,
),
)
return redirect(
reverse(
"apis:apis_entities:generic_entities_edit_view",
Expand Down

0 comments on commit c4dc573

Please sign in to comment.