Skip to content

Commit

Permalink
Merge pull request #26 from tbrlpld/laces-and-wagtail
Browse files Browse the repository at this point in the history
Add "Laces and Wagtail" section to README
  • Loading branch information
tbrlpld authored Feb 19, 2024
2 parents e749eb7 + 93c575a commit 65dc76d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- ...
- Added section on "Laces and Wagtail" to README. ([#26](https://github.com/tbrlpld/laces/pull/26))

### Changed

Expand Down Expand Up @@ -37,7 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Extracted component related code from Wagtail project for reuse.
- Extracted component related code from [Wagtail](https://pypi.org/project/wagtail/) project for reuse.

<!-- TEMPLATE - keep below to copy for new releases -->
<!--
Expand Down
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,25 @@ The constructor method allows us to keep our view very simple and clean as all t

As in the example above, custom constructor methods pair very well with the use of dataclasses, but they can of course also be used without them.

## About Laces and components
## About Laces

### Laces and Wagtail

As mentioned in the introduction, the Laces package was extracted from [Wagtail](https://pypi.org/project/wagtail/) to make it available to the wider Django ecosystem.
The Wagtail documentation still contains the section on what was called originally called ["Template Components"](https://docs.wagtail.org/en/v6.0.1/extending/template_components.html).
While the code for these components was defined in submodules of the `wagtail.admin` module, there was no limitation on them being only used in the Wagtail admin.

As of [Wagtail release 6.0](https://docs.wagtail.org/en/stable/releases/6.0.html#other-maintenance), Wagtail includes Laces as a dependency.
The original implementations of `Component` and `MediaContainer` classes as well as the `{% component %}` template tag have been replaced by imports of the equivalents from Laces.
The names are still available at their original import locations, `wagtail.admin.ui.components` and `wagtail.admin.templatetags.wagtailadmin_tags` respectively.
So, if you have been using these imports before, no change is needed, they still work.

If you want to start using components in a Wagtail project, you can use the Wagtail or Laces import paths interchangeably.
To be able to use the Laces template tag library with `{% load laces %}`, you need to add `laces` you your `INSTALLED_APPS`.

If you want to start using components with Wagtail on a release before 6.0, it is probably best to stick with the Wagtail imports.
This guarantees you won't run into any conflicts when upgrading.
All the patterns shown above should work regardless, only the import paths are different.

### Why "Laces"?

Expand Down

0 comments on commit 65dc76d

Please sign in to comment.