Skip to content

Commit

Permalink
replaced hardcoded url route with django reverse method
Browse files Browse the repository at this point in the history
  • Loading branch information
ashfaq1934 committed Oct 22, 2023
1 parent e919cdd commit 3cfc868
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions silk/views/request_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from django.shortcuts import HttpResponseRedirect, redirect, render
from django.utils.decorators import method_decorator
from django.views.generic import View
from django.urls import reverse_lazy, reverse

from silk.auth import login_possibly_required, permissions_possibly_required
from silk.code_generation.curl import curl_cmd
Expand Down Expand Up @@ -48,5 +49,5 @@ def post(self, request, request_id):
try:
silk_request.delete()
except Request.DoesNotExist:
return HttpResponseRedirect(request.headers.get('Referer', '/silk'))
return redirect('/silk')
return HttpResponseRedirect(request.headers.get('Referer', reverse("silk:summary")))
return redirect(reverse("silk:summary"))

Check warning on line 53 in silk/views/request_detail.py

View check run for this annotation

Codecov / codecov/patch

silk/views/request_detail.py#L48-L53

Added lines #L48 - L53 were not covered by tests

0 comments on commit 3cfc868

Please sign in to comment.