Reputation: 7792
this is a really basic question -
I have a model called Book, which has an attribute imageURL (which is a charfield).
I have this template code -
<text class= "text" id = "bookTitle">{{ book.title|safe }}</text><br/>
<text class= "text" id= "bookAuthor">by {{ book.author|safe }}</text><br/>
<img src= str(book.imageURL) class = "result" />
However, the str(book.imageURL) always returns an unicode value (because that's what Django models do?) - how can I get the string url so I can put it in here?
Thanks
Upvotes: 2
Views: 1443
Reputation: 5198
The template code is invalid, try this:
<text class= "text" id = "bookTitle">{{ book.title|safe }}</text><br/>
<text class= "text" id= "bookAuthor">by {{ book.author|safe }}</text><br/>
<img src="{{ book.imageURL }}" class = "result" />
Upvotes: 3