Why can't I do a hyphen in Django template view?

前端 未结 2 1123
礼貌的吻别
礼貌的吻别 2021-01-19 15:36
{{profile.first-name.value}}

My variable is hypeh only...I wish I could do first_name, but many variables are hyphens. However, du

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-19 16:28

    The hyphen is an operator in Python. It would work better if you swapped all hyphens for underscores.

提交回复
热议问题