valueerror the ‘photo’ attribute has no file associated with it

Your files and code are a bit confusing but this is what I think.

The error

ValueError at / The ‘photo’

is pretty clear. The photo has no file/attribute associated with it. I am also unsure as to what you expect this {{} to output — as from what I can see this will yield no value. If you think product refers to the file and photo refers to the defined attribute and url is an indirect variable of the photo object then this is a wrong approach.

See this answer here on how you should go about embedding URL in the src tag – How to add django template variable in img src tag

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top