Django-cotton

Latest version: v1.5.1

Safety actively analyzes 688087 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 10

31.83

---

Block and Extends (Django equivalent)


Django average: 9.38 ms



- Cotton before: 11.38 ms
- Cotton after: 10.56 ms

7.21

---

Include


Django average: 3.12 ms



- Cotton before: 3.16 ms
- Cotton after: 3.04 ms


✅ Cotton performs on-par with Django when used as partial inclusion.

---

⚠️ Possible breaking changes:

- Boolean attributes were previously triggered even when an attribute had an intentional empty srtring:

html
<c-comp myattr />
<c-comp myattr="" />
<c-comp :myattr="i_evaluate_as_empty_string" />

{{ myattr }} <!-- All cases above parse as True


This has now been fixed and only valueless attributes will render as True. Although this was unintentional, some of you may have relied on this defunct behaviour, so be sure to test.


* Support quoted json-like values in {{ attrs }} by mattbha in https://github.com/wrabit/django-cotton/pull/137
* updated render benchmarks by wrabit in https://github.com/wrabit/django-cotton/pull/138
* Support proper boolean attributes by wrabit in https://github.com/wrabit/django-cotton/pull/139
* Tags rewrite + optimisations (up to 28% faster) by wrabit in


**Full Changelog**: https://github.com/wrabit/django-cotton/compare/v0.9.40...v1.0.0

1.5.1

`COTTON_BASE_DIR` to set project base location

* Don't rely on existence of BASE_DIR settings variable. by fbinz in https://github.com/wrabit/django-cotton/pull/234

New Contributors
* fbinz made their first contribution in https://github.com/wrabit/django-cotton/pull/234

**Full Changelog**: https://github.com/wrabit/django-cotton/compare/v1.5.0...v1.5.1

1.5.0

Support shorthand alpine.js `x-bind` with `::`
* Support colon escaping - alpinejs bind shortcut support by wrabit in https://github.com/wrabit/django-cotton/pull/227
* More here: https://django-cotton.com/docs/components#alpine-js-support
* Related discussion 180


**Full Changelog**: https://github.com/wrabit/django-cotton/compare/v1.4.0...v1.5.0

1.4.0

Support for top-level project root `templates`

If you are a top-level templates person, you can now place your cotton components in the project root folder. Both of these approaches are supported:

- `[project]/templates/cotton/...` (NEW)
- `[project]/[app]/templates/cotton/...`

**Full Changelog**: https://github.com/wrabit/django-cotton/compare/v1.3.0...v1.4.0

1.3.0

Support hyphenated filenames
* added support for hyphenated component filenames by wrabit in https://github.com/wrabit/django-cotton/pull/214

This introduces a new config option as detailed in the docs: https://django-cotton.com/docs/configuration.

Summary

`<c-my-button />`

Filepath before: `cotton/my_button.html`

Filepath after: `cotton/my-button.html`
(with `COTTON_SNAKE_CASED_NAMES = False`)

What else

* raise value error when multiple c-vars provided by wrabit in https://github.com/wrabit/django-cotton/pull/213

Cotton only supports a maximum of 1 `c-vars` tag per component. Some user's reach for using multiple, which is not currently supported. To ensure this is clear, cotton now raises an exception when it detects more than one `c-vars` in a component.

**Full Changelog**: https://github.com/wrabit/django-cotton/compare/v1.2.1...v1.3.0

Page 1 of 10

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.