Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid blocks check is faulty #51

Open
Mte90 opened this issue Nov 6, 2024 · 8 comments
Open

Invalid blocks check is faulty #51

Mte90 opened this issue Nov 6, 2024 · 8 comments

Comments

@Mte90
Copy link
Contributor

Mte90 commented Nov 6, 2024

With https://github.com/unfoldadmin/django-unfold in my case is Invalid blocks specified: for branding.
Also if I put django_fastdev as last app I am getting that error for a block of that template of that package that I don't duplicated in my project.

After investigating a bit in my case is that the blocks doesn't exist as it is a package that has a logic to not print them if found them in various HTML files so the logic right now doens't work.

For fastdev is invalid but in reality is not declared or unused.
It should load all the template files to check if a block exists or not and the alert should be different but right now there are no options to disable that alert.

As you can see on https://github.com/unfoldadmin/django-unfold/blob/541a1577ec93630a9c99ec623d395a26c7098b65/src/unfold/templates/unfold/helpers/navigation.html#L10 if the block is not available the file is not loaded so the block for fastdev is not valid but in reality there shouldn't be any errors.

@boxed
Copy link
Owner

boxed commented Nov 6, 2024

Hmm, I don't understand. You are talking about the invalid block check, but you link to code that references a variable, not a block. I don't see the connection.

@Mte90
Copy link
Contributor Author

Mte90 commented Nov 6, 2024

@boxed
Copy link
Owner

boxed commented Nov 6, 2024

Ah. I see the problem. CaptureNode is incorrect. It does not declare child_nodelists = ('nodelist',) as it should.

@Mte90
Copy link
Contributor Author

Mte90 commented Nov 6, 2024

Reported at unfoldadmin/django-unfold#839

@boxed
Copy link
Owner

boxed commented Nov 6, 2024

You can also easily monkey patch that attribute yourself to verify.

@Mte90
Copy link
Contributor Author

Mte90 commented Nov 6, 2024

Suggestions on how to do that?

@boxed
Copy link
Owner

boxed commented Nov 6, 2024

Write

CaptureNode.child_nodelists = ('nodelist', )

somewhere where it is run before the template is loaded.

@Mte90
Copy link
Contributor Author

Mte90 commented Nov 19, 2024

I opened a PR with the patch on unfoldadmin/django-unfold#863 (comment) but does't seems that fix the issue

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

No branches or pull requests

2 participants