Skip to content

Fix possible unbound variable issue in skeleton#1973

Open
tomdtp wants to merge 2 commits into
unfoldadmin:mainfrom
tomdtp:fix/unauthenticated-unbound-flags
Open

Fix possible unbound variable issue in skeleton#1973
tomdtp wants to merge 2 commits into
unfoldadmin:mainfrom
tomdtp:fix/unauthenticated-unbound-flags

Conversation

@tomdtp

@tomdtp tomdtp commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Fixes self-referential template issues that showed up with django-fastdev enabled.

Also the regular changelist now follows Django’s own action_form / cl.show_admin_actions contract again, while dataset views get an explicit has_action_form flag so they only show bulk-action UI when actions are actually available.

@tomdtp tomdtp changed the title Fix/unauthenticated unbound flags Align template action rendering with Django defaults and fix unbound variable handling Apr 13, 2026
@lukasvinclav

lukasvinclav commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Thanks for PR. Can you provide a description how can I replicate the issue so I can test it on local machine? I'm particularly interested in testing unfold_admin_actions.

btw you forget to fill the template questions ;-) Did you used AI to create this code?

@tomdtp tomdtp force-pushed the fix/unauthenticated-unbound-flags branch from b1683d0 to 7f7c222 Compare April 14, 2026 12:01
@tomdtp

tomdtp commented Apr 14, 2026

Copy link
Copy Markdown
Contributor Author

I separated the 2 issues, so this is now just a fix for the unbound self referencing variables.

To reproduce this you can add django-fastdev to the project and then add FASTDEV_STRICT_TEMPLATE_CHECKING = True to the settings.py. You will then directly see the unbound variable error for is_fullwidth. (if you are on main, from this branch it is fixed) if you are unauthenticated and go to the login page of the django admin.

sorry, I did not see any template questions. I just checked the other open PRs and also couldn't see any templates. so if you have questions please ask away :) I did use AI to review the code change (because I wanted it to doublecheck the default values)

the extracted issue is a contract issue, I will issue a separate pr for it

@tomdtp tomdtp changed the title Align template action rendering with Django defaults and fix unbound variable handling Fix possible unbound variable issue in skeleton Apr 14, 2026
@tomdtp

tomdtp commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

any chance this can get merged? it is very disruptive in my dev workflow if the login page with django-fastdev keeps showing errors because of unbound template variables

@lukasvinclav

Copy link
Copy Markdown
Contributor

@tomdtp hey Tom, as a team of one, it is pretty hard to go through everything and do a proper testing. So right now, there is no estimate when I will have time to think what I will do with this PR.

@tomdtp

tomdtp commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

@lukasvinclav ok, I understand. thanks for the great work on unfold it is such an improvement over the default django admin!

@lukasvinclav

Copy link
Copy Markdown
Contributor

@tomdtp I hope I didn't let you down. The "problem" here is that I have no experience with the plugin which you are using so I have to get familiar with it. Anyway, if you find something else don't feel discouraged and just post the issue here.

@tomdtp

tomdtp commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

@lukasvinclav no, no worries, it is not a critical issue in the sense that something breaks on production. django-fastdev just helps you during development by showing errors when you have unbound variables in a template. Django silently just shows nothing, which can lead to frustrating errors. Since I have django-fastdev enabled during development I cannot open unfold without logging in via our main login page first, because the unfold login page has these unbound variables.

I am not affiliated with django-fastdev in any way, I just think it is a very helpful lib to spot possible problems / errors early on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants