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

Add django-template-partials example to Tips #413

Merged
merged 3 commits into from
Oct 25, 2024

Conversation

carltongibson
Copy link
Contributor

Hey @adamchainz 👋

I saw on the Fedi that you might accept an example using django-template-partials to the tips section, so I drafted one.

@adamchainz
Copy link
Owner

This project uses present tense PR titles/commit messages without a full-stop at the end, because that makes grammatical sense for a headline 😉

@adamchainz adamchainz changed the title Added django-template-partials example to Tips. Add django-template-partials example to Tips Jan 21, 2024
@adamchainz
Copy link
Owner

I like the start here, but I think we should have two sections. One to cover the “render a small portion of the page” style that django-template-partials is perfect for, and another for the “render the only main section” style that the current tip covers. I wrote the current tip after several people asked for it, but I think the django-template-partials style is more in-keeping with the htmx philosophy.

WDYT?

@carltongibson
Copy link
Contributor Author

Hey @adamchainz — It's your package, so happy to follow your lead. 😀

From what you wrote I can't quite work out if you mean:

  1. Have two examples using django-template-partials for the small snippet and just the main content (so add a second example to this PR) or...
  2. Replace the example I added here with just a small snippet case?

FWIW I'm using dtp for both IRL, but I'd rather add the example(s) you'd be happiest with here.

LMK and I'll update. 🎁

@adamchainz
Copy link
Owner

Coming back to django-htmx after a bit of a break. I think perhaps let’s change to showcase only django-template-partials, especially since you’ll now be getting something similar into Django itself. Let’s make these changes:

  1. Update the “partial rendering” demo in the example app to use django-template-partials, probably using a second view to render the table partial.
  2. Split the tips into two: “Partial rendering of a section” and ”Partial rendering of main content”.
  3. In “Partial rendering of a section”, cover the demo from the example project.
  4. In “Partial rendering of main content”, put the tip as you’ve contributed here. Put the intro paragraph from the old tip: “For requests made with htmx...”.
  5. Preserve the existing content, with a warning about it being more involved and a kind-of legacy method, under “Partial rendering of main content with template inheritance”.

What do you think?

@carltongibson
Copy link
Contributor Author

Hey @adamchainz. Makes sense. Give me a little cycle and I'll get that done. 👍

docs/tips.rst Outdated Show resolved Hide resolved
@carltongibson
Copy link
Contributor Author

@adamchainz I've made the changes in the example project. I updated the existing view. Do you think it's worth duplicating what's there to have both methods runnable?

Will move to docs next.

@carltongibson
Copy link
Contributor Author

carltongibson commented Aug 25, 2024

Hey @adamchainz. Summer 🏖️

I've made what I hope is an OK pass at the suggested changes. If you could glance at them when you can, I can make any adjustments you want, and then squash down etc. (Do just edit, if that's easier for you too!)

Thanks.

@adamchainz adamchainz enabled auto-merge (squash) October 25, 2024 21:20
@adamchainz adamchainz merged commit 2aa0fec into adamchainz:main Oct 25, 2024
9 checks passed
@adamchainz
Copy link
Owner

Okay, finally, there we go! Thank you 💚

@carltongibson
Copy link
Contributor Author

Slowly slowly catchy monkey 🐵

Thanks Adam.

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