我将字典发送给Django模板,其“”已转换为“如何转换或替换它?”
我尝试使用替换功能,但不起作用。
Dictionary_passed = {"-" : "100", "GERMANY" : "1500"}
In the HTML template I got
{'-':'100','GERMANY':'1500' }
on Dictionary_passed.replace(''', ''), I get:
{'l-':100, 'GERMANY':1500}
**__all_users is query set returned by auth_User, userprofile is just another table that extends auth_user**
countries_list = dict(collections.Counter(map(lambda z : z.upper().strip(), 100*list(__all_users.values_list('userprofile__country', flat=True)))))
I have passed countries_list to the Django Template