--
Ticket URL: <https://code.djangoproject.com/ticket/32397>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* Attachment "add-user-agent-to-django-admin-templates.diff" added.
Old description:
> By default, when fetching a remote template, django-admin
> start[app|project] uses the default urllib User Agent which causes some
> sites to block requests (namely gitlab, since they use cloudflare See
> https://gitlab.com/gitlab-org/gitlab/-/issues/219669).
New description:
By default, when fetching a remote template, django-admin
start[app|project] uses the default urllib User Agent which causes some
sites to block requests (namely gitlab, since they use cloudflare See
https://gitlab.com/gitlab-org/gitlab/-/issues/219669).
This patch sets the 'User Agent' header to Django/DJANGO_VERSION.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/32397#comment:1>
* Attachment "add-user-agent-to-django-admin-templates.diff" added.
* owner: rsp2k => (none)
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/32397#comment:2>
* status: new => closed
* type: New feature => Cleanup/optimization
* resolution: => needsinfo
* needs_tests: 0 => 1
Comment:
Hi rsp2k.
I'm inclined to accept this — no problem setting the User-Agent.
Initially though I'm going to close as `needsinfo` — that info being,
**are you up for finishing this**?
I see you removed your assignment, but the patch needs tests. Specifically
they could go in `django/tests/admin_scripts/tests.py` in the
`StartProject` and `StartApp` classes.
If so can you add the tests, [https://github.com/django/django/pulls open
a PR on GitHub], re-open the ticket, and assign yourself again?
Thanks.
--
Ticket URL: <https://code.djangoproject.com/ticket/32397#comment:3>
* status: closed => new
* resolution: needsinfo =>
Comment:
Thank you for your reply. I am working on the tests now and will follow
the steps you outlined.
I took myself off the ticket because I thought it might not get routed
properly, my mistake. I'm reassigning it now.
--
Ticket URL: <https://code.djangoproject.com/ticket/32397#comment:4>
* owner: (none) => rsp2k
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/32397#comment:5>
* stage: Unreviewed => Accepted
Comment:
Super, thanks for the follow-up! Let's accept for review. Welcome aboard!
--
Ticket URL: <https://code.djangoproject.com/ticket/32397#comment:6>
* cc: Ad Timmering (added)
* needs_tests: 1 => 0
Comment:
Have taken the liberty of adding tests to rsp2k's patch in this
[https://github.com/django/django/pull/15111 PR].
Feels like there should be a cleaner way to get the UA from the request;
ideas very welcome.
--
Ticket URL: <https://code.djangoproject.com/ticket/32397#comment:7>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/32397#comment:8>
* owner: rsp2k => Ad Timmering
* needs_better_patch: 1 => 0
Comment:
[https://github.com/django/django/pull/15111 PR] updated reflecting
feedback, and rebased to main.
--
Ticket URL: <https://code.djangoproject.com/ticket/32397#comment:9>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/32397#comment:10>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"9a6e2df3a8f01ea761529bec48e5a8dc0ea9575b" 9a6e2df3]:
{{{
#!CommitTicketReference repository=""
revision="9a6e2df3a8f01ea761529bec48e5a8dc0ea9575b"
Fixed #32397 -- Made startapp/startproject management commands set User-
Agent.
This sets User-Agent to 'Django/<version>'.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/32397#comment:11>