#35244: URL resolution does not work when giving a function reference if it is listed in `urls` with `app_name` -------------------------------------+------------------------------------- Reporter: Willem | Owner: nobody Van Onsem | Type: | Status: new Uncategorized | Component: Core | Version: 5.0 (URLs) | Keywords: urls, resolve, Severity: Normal | reverse, resolution Triage Stage: | Has patch: 1 Unreviewed | Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -------------------------------------+------------------------------------- First mentioned on StackOverflow with: https://stackoverflow.com/questions/78035103/in-django-is-it-possible-to- use-reverse-redirect-with-a-view-function-not-stri
This is because the `.reverse_dict` dictionary is not populated with view functions, or at least not if there is an `app_name` around line 563 of `resolvers.py`: https://github.com/django/django/blob/6feaad9113fd38ba3970032d2b7856c77403e29e/django/urls/resolvers.py#L563-L567 A patch is quite simple: look in the `.reverse_dict` of the subpath, and propagate the values to the upper level in case these are callable (see patch). But the question is of course if this approach is sound and complete. -- Ticket URL: <https://code.djangoproject.com/ticket/35244> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/0107018dcc54a633-25880b1f-88e3-483e-9cb4-d23684e4fbe6-000000%40eu-central-1.amazonses.com.