2

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

praks5432
  • 7,246
  • 32
  • 91
  • 156

1 Answers1

3

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" />
Gabriel Ross
  • 5,168
  • 1
  • 28
  • 30