diff --git a/conntrackt/views.py b/conntrackt/views.py --- a/conntrackt/views.py +++ b/conntrackt/views.py @@ -707,15 +707,11 @@ class CommunicationCreateView(MultiplePe Returns the URL to which the user should be redirected after a communication has been created. - The URL will be set to entity details page of an entity that was - provided as part of the from/to GET request (in that order), or as a - fallback it'll direct the user to source interface's entity details - page. + The URL will either point to value provided via GET parameter "next", or + to project page to which the communication belongs. """ - entity_id = self.request.GET.get("from_entity", None) or self.request.GET.get("to_entity", None) or self.object.source.entity.pk - - return reverse("entity", args=(entity_id,)) + return self.request.GET.get("next", reverse("project", args=(self.object.source.entity.project.pk,))) class CommunicationUpdateView(MultiplePermissionsRequiredMixin, UpdateView): @@ -759,15 +755,11 @@ class CommunicationUpdateView(MultiplePe Returns the URL to which the user should be redirected after a communication has been created. - The URL will be set to entity details page of an entity that was - provided as part of the from/to GET request (in that order), or as a - fallback it'll direct the user to source interface's entity details - page. + The URL will either point to value provided via GET parameter "next", or + to project page to which the communication belongs. """ - entity_id = self.request.GET.get("from_entity", None) or self.request.GET.get("to_entity", None) or self.object.source.entity.pk - - return reverse("entity", args=(entity_id,)) + return self.request.GET.get("next", reverse("project", args=(self.object.source.entity.project.pk,))) class CommunicationDeleteView(MultiplePermissionsRequiredMixin, DeleteView):