Skip to content

No way to specify objects that have attributes and support iteration #10

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

Closed
thibaudcolas opened this issue Feb 19, 2020 · 3 comments
Closed
Labels
decision needed This requires a decision django Related to Django templates capabilities enhancement New feature or request
Milestone

Comments

@thibaudcolas
Copy link
Member

thibaudcolas commented Feb 19, 2020

In GitLab by @bcdickinson on Dec 19, 2017, 22:15

Motivating example from: search results. search_results value is both iterated and accessed with dot notation:

{% for result in search_results %}
{% if search_results.paginator.count %}

The YAML format doesn't support specifying values that behave this way. A possible suggestion would be to allow numeric keys in the YAML e.g.

search_results:
  paginator:
    count: 42
  0: ... # result 1
  1: ... # result 2
  ...
@thibaudcolas thibaudcolas added kind/enhancement enhancement New feature or request decision needed This requires a decision and removed kind/enhancement labels Feb 19, 2020
@thibaudcolas
Copy link
Member Author

This seems like a fairly common scenario, that should at least be documented.

@thibaudcolas thibaudcolas added the documentation Improvements or additions to documentation label Feb 24, 2020
@thibaudcolas thibaudcolas added this to the Nice to have milestone Feb 24, 2020
@thibaudcolas thibaudcolas added storybook Usage of Storybook will affect this django Related to Django templates capabilities labels Feb 24, 2020
@thibaudcolas
Copy link
Member Author

Mentioned in the docs as of #131.

@thibaudcolas thibaudcolas removed documentation Improvements or additions to documentation storybook Usage of Storybook will affect this labels Oct 30, 2020
@thibaudcolas
Copy link
Member Author

Fixed in #141 :)

@thibaudcolas thibaudcolas moved this to Low priority in Roadmap Aug 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
decision needed This requires a decision django Related to Django templates capabilities enhancement New feature or request
Projects
No open projects
Status: Low priority
Development

No branches or pull requests

1 participant