Skip to content

Conversation

RealOrangeOne
Copy link
Member

@RealOrangeOne RealOrangeOne commented Jul 5, 2024

Trac ticket number

ticket-35535

See also related forum thread: https://forum.djangoproject.com/t/feature-proposal-simple-block-tag/32229

Branch description

Django's simple_tag is difficult to work with if you need to capture more complex content as one of the arguments.

This PR adds the ability to define custom "block" tags, which capture their contents as the content argument.

There are probably some built-in tags which could take advantage of this, but I've left those out-of-scope of this PR. The same is true for extra niceties like a built-in capture tag, passing the un-rendered content into the tag instead or a combination with inclusion_tag etc. See #18343 (comment) for the small diff needed to support inclusion_block_tag in future.

Checklist

  • This PR targets the main branch.
  • The commit message is written in past tense, mentions the ticket number, and ends with a period.
  • I have checked the "Has patch" ticket flag in the Trac system.
  • I have added or updated relevant tests.
  • I have added or updated relevant docs, including release notes if applicable.
  • I have attached screenshots in both light and dark modes for any UI changes.

@RealOrangeOne RealOrangeOne force-pushed the 35535-simple-block-tag branch from d710f1a to b75ca05 Compare July 5, 2024 14:46
Copy link
Contributor

@sarahboyce sarahboyce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this @RealOrangeOne, added initial comments
We need a release note in 5.2 👍

Copy link
Contributor

@sarahboyce sarahboyce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the updates @RealOrangeOne 👍

We still need a release note adding to 5.2

Copy link
Contributor

@nessita nessita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some comments, thank you @RealOrangeOne for this work!

@RealOrangeOne RealOrangeOne force-pushed the 35535-simple-block-tag branch 2 times, most recently from b179626 to 8f33d52 Compare September 6, 2024 10:35
Copy link
Contributor

@nessita nessita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @RealOrangeOne! I gave this another top-bottom pass. Once the minor nitpicks are fixed, I need to do a in-depth review in terms of test coverage and functionality. That would be after DjangoCon US.

Amazing work so far! 🌟

@RealOrangeOne RealOrangeOne force-pushed the 35535-simple-block-tag branch 2 times, most recently from 8e211e0 to cc67d6e Compare October 22, 2024 14:35
@RealOrangeOne RealOrangeOne force-pushed the 35535-simple-block-tag branch from cc67d6e to c4b2855 Compare October 24, 2024 10:48
@nessita nessita force-pushed the 35535-simple-block-tag branch from c4b2855 to 53e9444 Compare November 14, 2024 17:30
Copy link
Contributor

@nessita nessita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a new subsection in the docs with a more complete/complex example. I built it from real use case I had to solve a while ago. From my view, this is ready to be merged.

@sarahboyce @adamchainz @carltongibson I'm keen to know what you think of the latest version of the docs. Ideally I'll merge in about a week, depending on your feedback. Thanks!

@nessita nessita force-pushed the 35535-simple-block-tag branch from 53e9444 to 16fe320 Compare November 19, 2024 01:45
@nessita nessita force-pushed the 35535-simple-block-tag branch from 16fe320 to 7a30f72 Compare November 19, 2024 14:30
@nessita nessita merged commit 4c452cc into django:main Nov 19, 2024
44 checks passed
@RealOrangeOne RealOrangeOne deleted the 35535-simple-block-tag branch November 20, 2024 15:50
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.

5 participants