Skip to content

Calling reverse in templatetags reverts admin site to default #1120

@dickermoshe

Description

@dickermoshe

What version of Unfold are you using?

v0.50.0

What version of Django are you using?

Chrome 133.0.6943.142 (Official Build) (64-bit)

What browser are you using?

For example: Firefox 128.0

Did you checked changelog/commit history, if the bug is not already fixed?

Yes

Did you searched other issues, if the bug is not already fixed?

Yes

Did you checked documentation?

Yes

Are you able to replicate the bug in the demo site?

Yes

Repository with reproduced bug

https://github.com/dickermoshe/repro_unfold

Describe your issue

I'm using reactpy_django and it's seems that it replaces the unfold site with the default site when it's setup.
The result is an empty admin site that has no models registered.

The sequence of events are as follows:

  1. Unfold replaces admin site
  2. Models are registered on the Unfold site
  3. calling reverse in templatetags reverts back the original site
  4. This is becuase reverse calls resolver.app_dict which forces the resolver to _populate(). This completly recomputes the entire urlresolver

I traced the issue to using reverse function in templatetags. The repo above contains a self contained reproduction of this issue without reactpy_django.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions