8000 Feature/sorted option for Attributes Widget by fsbraun · Pull Request #48 · django-cms/djangocms-attributes-field · GitHub
[go: up one dir, main page]

Skip to content

Feature/sorted option for Attributes Widget #48

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

Merged
merged 8 commits into from
Mar 27, 2022

Conversation

fsbraun
Copy link
Member
@fsbraun fsbraun commented Mar 23, 2022

This PR adds an optional parameter to the AttributesWidget which is a widely used to supply attributes to html tags. HTML attributes do not have an order which is why the AttributesWidget displays them alphabetically by key.

With this PR AttributesWidget(sorted=False) keeps the attributes in order of the dictionary used (which since python 3.6 is preserved). This allows the reuse of the widget for other key value pairs, such as, e.g., choices.

If no sorted parameter is given the AttributesWidget retains alphabetical order to stay backwards compatible.

Sorry, this PR might have overlapping commits with #47

@codecov-commenter
Copy link
codecov-commenter commented Mar 23, 2022

Codecov Report

Merging #48 (be84010) into master (ab462c0) will decrease coverage by 0.58%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##           master      #48      +/-   ##
==========================================
- Coverage   90.25%   89.67%   -0.59%     
==========================================
  Files           3        3              
  Lines         154      155       +1     
  Branches       29       30       +1     
==========================================
  Hits          139      139              
  Misses         10       10              
- Partials        5        6       +1     
Impacted Files Coverage Δ
djangocms_attributes_field/widgets.py 97.29% <66.66%> (-2.71%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ab462c0...be84010. Read the comment docs.

@marksweb marksweb merged commit 34070bf into django-cms:master Mar 27, 2022
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.

3 participants
0