We have a `FormView` that defines the `get_success_url` method as follows:
{{{
def get_success_url(self):
"""
Redirect to self
"""
success = urllib.parse.urlencode({'success': self.n_deleted})
return f'?{success}'
}}}
In actual browsers this results in a redirect to the original request's
path with the querystring attached. The Django TestClient behaved the same
way, but after the update to Django 4.0a1 it suddenly redirects to
`/?success=1`.
This seems to be caused by the fix for #32790
--
Ticket URL: <https://code.djangoproject.com/ticket/33132>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by Jaap Roes):
Looking at #32790 it seems that there should also be a check that
`url.netloc` isn't empty before setting `path` to `'/'`
--
Ticket URL: <https://code.djangoproject.com/ticket/33132#comment:1>
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted
Comment:
Hey Jaap — I didn't look in depth yet, but that sounds right. Do you want
to make a patch?
Thanks.
--
Ticket URL: <https://code.djangoproject.com/ticket/33132#comment:2>
* owner: nobody => Jaap Roes
* status: new => assigned
Comment:
I'll look into fixing this tomorrow
--
Ticket URL: <https://code.djangoproject.com/ticket/33132#comment:3>
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/14884 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/33132#comment:4>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/33132#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"b1bf8c8a4ba04049dc19217bf0e876488a4fae3c" b1bf8c8a]:
{{{
#!CommitTicketReference repository=""
revision="b1bf8c8a4ba04049dc19217bf0e876488a4fae3c"
Fixed #33132 -- Fixed test client handling of querystring only redirects.
Regression in 1e5aa8e1c79252cc810af21294a6e945d11d37b3.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33132#comment:6>
Comment (by Carlton Gibson <carlton.gibson@…>):
In [changeset:"5d36af6f6fe7766c1d2d3ea8c261ed22da2861af" 5d36af6f]:
{{{
#!CommitTicketReference repository=""
revision="5d36af6f6fe7766c1d2d3ea8c261ed22da2861af"
[4.0.x] Fixed #33132 -- Fixed test client handling of querystring only
redirects.
Regression in 1e5aa8e1c79252cc810af21294a6e945d11d37b3.
Backport of b1bf8c8a4ba04049dc19217bf0e876488a4fae3c from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33132#comment:7>