Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Richtermeister
Copy link

I have data from an external source which contains map[string]interface{} instances with numeric keys:

map[string]interface{}{
  "0": "foo",
  "1": "bar",
}

I'm trying to access this map via this template {{ mydict.0 }} as I would a regular map, but Pongo2 doesn't seem to allow this:

Can't access an index on type map (variable mydict.0)

This PR adds this capability.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@Richtermeister
Copy link
Author

Richtermeister commented Dec 10, 2021 via email

@Richtermeister
Copy link
Author

@flosch Sorry to bother, could I please get some feedback on this PR? It seems straight-forward and has test coverage. If there's anything else I can do to unblock this, please let me know. Thank you for your time.

@flosch
Copy link
Owner

flosch commented Jun 24, 2022

Hi, this should be resolved by the introduced subscript syntax (#281): mydict["0"]

If not, feel free to re-open/answer again. Thanks!

@flosch flosch closed this Jun 24, 2022
@Richtermeister
Copy link
Author

Yes that looks good, I'll give that a shot! Thank you for your efforts on this library, I really appreciate it.

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.

2 participants