Django-cotton

Latest version: v1.5.1

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

Scan your dependencies

Page 9 of 10

0.9.15

What's Changed
* converts hyphen var names to uderscores for access by wrabit in https://github.com/wrabit/django-cotton/pull/41

When we want to explicitly access attribute as a var which has '-' hyphens, it will be accessible by the snake case form. i.e.

html
<c-component x-data="{}" />



{{ x_data }}


**Note:** This does not affect attribute names within `{{ attrs }}` where any hyphenated name will stay hyphenated.


**Full Changelog**: https://github.com/wrabit/django-cotton/compare/v0.9.14...v0.9.15

0.9.14

What's Changed
* Optimise cvars by wrabit in https://github.com/wrabit/django-cotton/pull/39

The vars frame is now only used when we have specified a `<c-vars />` tag in a compoent. From benchmarks, there's a ~15% performance increase:

10k components rendering:

Before:
1.71s

After:
1.39s

**Full Changelog**: https://github.com/wrabit/django-cotton/compare/v0.9.13...v0.9.14

0.9.13

What's Changed
* allow new lines in attrs by wrabit in https://github.com/wrabit/django-cotton/pull/38

We can now use multi-line attribute values, like:

html
<div x-data="{
something: true
}">
...
</div>

0.9.12

What's Changed

* Dropped suffix requirement by wrabit in https://github.com/wrabit/django-cotton/pull/32

Breaking changes:

Cotton no longer requires the `.cotton.html` suffix on component or view templates. A simple `.html` will do. This is to optimise experience and help reduce any 'project creep' the original implementation introduced.

- Rename our cotton related files, from`[filename].html.cotton` -> [fileame]`.html`
- If you have cotton in production, it's recommended to clear the Django cache

This will ensure the cache rebuilds in the next visit to the page.

**Full Changelog**: https://github.com/wrabit/django-cotton/compare/v0.9.11...v0.9.12

0.9.11

What's Changed
- Attribute ordering was not being kept during compilation which was breaking situations when we are using template expressions to govern attributes in HTML tags
* Refactor loader + keep attribute ordering by wrabit in https://github.com/wrabit/django-cotton/pull/27

**Full Changelog**: https://github.com/wrabit/django-cotton/compare/v0.9.10...v0.9.11

0.9.10

What's Changed

Ensures that the new template expression attributes are also provided in `{{ attrs }}` alongside all normal attributes.

* added expression attributes to {{ attrs }} by wrabit in https://github.com/wrabit/django-cotton/pull/25


**Full Changelog**: https://github.com/wrabit/django-cotton/compare/v.0.9.8...v0.9.10

v.0.9.9
What's Changed

Using template variables in attributes

Cotton now allows you to include template variables inside attributes.

html
<c-weather icon="fa-{{ icon }}"
unit="{{ unit|default:'c' }}"
condition="very {% get_intensity %}"
/>


* Docs fix by wrabit in https://github.com/wrabit/django-cotton/pull/20
* implemented variables and template methods inside attributes by wrabit in https://github.com/wrabit/django-cotton/pull/23
* updated poetry lock by wrabit in https://github.com/wrabit/django-cotton/pull/24


**Full Changelog**: https://github.com/wrabit/django-cotton/compare/v.0.9.7...v.0.9.8

v.0.9.7
What's Changed

Passing Python data types

Using the `:` to prefix an attribute tells Cotton we're passing a dynamic type down. We already know we can use this to send a variable, but you can also send basic python types, namely:

- Integers and Floats
- None
- True and False
- Lists
- Dictionaries

This benefits a number of use-cases, for example if you have a select component that you want to provide some value:

html
<!-- select.cotton.html -->
<select {{ attrs }}>
{% for option in options %}
<option value="{{ option }}">{{ option }}</option>
{% endfor %}
</select>

<c-select name="q1" :options="['yes', 'no', 'maybe']" />

html
<!-- output -->
<select name="q1">
<option value="yes">yes</option>
<option value="no">no</option>
<option value="maybe">maybe</option>
</select>


More

* Literal eval on ":" attrs and vars by wrabit in https://github.com/wrabit/django-cotton/pull/19
* 16
* https://django-cotton.com/docs/components#python-types


**Full Changelog**: https://github.com/wrabit/django-cotton/compare/v.0.9.6...v.0.9.7

v.0.9.6
What's Changed (**Breaking change**)
* Rename c props by wrabit in PR: https://github.com/wrabit/django-cotton/pull/15, all `<c-props />` are now `<c-vars />`, see issue: #14


**Full Changelog**: https://github.com/wrabit/django-cotton/compare/v0.9.4...v.0.9.6

Page 9 of 10

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.