Django view - redirect to one page and open another in new tab

I have a Django view that looks like this:

def edit_view(request, pk)

    # do something ...

    messages.success(request, "Success!")
    return redirect('index')

The view should redirect to "index" (like in the code above), but it should also, at the same time, open another (second) page in new tab.

How can this be achieved?

I think this task is not for Django but javascript. For the Django view could be posible to send a JsonResponse containing the redirect link and the new tab one.

  "status": "ok",
  "data": {
    "redirect": "/some/redirect/link",
    "new_tab": "/some/new-tab/link"

Then use JS
window.location.href =
Back to Top