Performance: Redirects with redirect function
MEDIUM IMPACT
This affects page load speed by adding extra HTTP requests and delays before the final content loads.
def submit_view(request): if request.method == 'POST': # process form return redirect('/final-url/') # direct redirect to final destination
def submit_view(request): if request.method == 'POST': # process form return redirect('/old-url/') # redirects to another URL which then redirects again # /old-url/ view redirects again to /final-url/
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Multiple chained redirects | 0 (no DOM until final page) | 0 | 0 | [X] Bad |
| Single direct redirect | 0 (no DOM until final page) | 0 | 0 | [OK] Good |