Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

{{profile.first-name.value}}

My variable is hypeh only...I wish I could do first_name, but many variables are hyphens. However, due to this problem, I can't display my variables in the template. Why?

like image 591
TIMEX Avatar asked Feb 06 '10 13:02

TIMEX


1 Answers

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

like image 60
Skilldrick Avatar answered Oct 08 '22 22:10

Skilldrick