Django could not parse the remainder

Skip to first unread message

Koushik Romel

Jun 20, 2022, 10:52:46 AMJun 20
to Django users
When trying to get a value from restapi in for loop to display it takes hyphen(-) as minus(-). And there is no way to change the api structure because it is fixed.
Im struck in this anyone help me..
The exact error and the expected json is given below is down below

when i try to print {{key}} the whole for loop data it displays like this
{'_id': ObjectId('xxxxxxxxxxx'), 'date': 'jun/20/2022', 'dst-active': 'false', 'gmt-offset': '+05:30', 'time': '20:19:04', 'time-zone-autodetect': 'true', 'time-zone-name': 'Asia/Kolkata'}

when i specify {{key.dst-active}} it throws this error
TemplateSyntaxError at /store/Could not parse the remainder: '-active' from 'key.dst-active'

Ryan Nowakowski

Jun 23, 2022, 9:45:08 AMJun 23
to Django users

Lakshyaraj Dash XI-D 25

Jun 23, 2022, 10:17:14 AMJun 23
You can have a template filter that can parse your dictionary.

You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Shaheed Haque

Jun 23, 2022, 1:05:32 PMJun 23
From memory, At least in Jinja templates, you can explicitly use the dictionary form {{ key["hypen-ated"] }}... Have you tried that? 

Reply all
Reply to author
0 new messages