Opened 7 years ago
Last modified 7 years ago
#28703 closed Cleanup/optimization
Endpoint regex pattern construction is not stable — at Initial Version
Reported by: | Erik Bryant | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 1.11 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
https://github.com/django/django/blob/master/django/contrib/admin/sites.py#L277
The regex pattern that is constructed for an endpoint is not stable. For instance, in my project I have seen it construct each of the following:
admin/(?P<app_label>social_django|authtoken|queues|jobs|files|users|clusters|appps|auth|vdcs)/$
admin/(?P<app_label>social_django|auth|users|vdcs|appps|jobs|queues|authtoken|clusters|files)/$
admin/(?P<app_label>authtoken|appps|social_django|clusters|users|queues|jobs|vdcs|auth|files)/$
admin/(?P<app_label>authtoken|appps|social_django|clusters|users|queues|vdcs|jobs|auth|files)/$
This precludes the use of patterns in unit tests.