-1

I'm in model author create a field for upload picture for my author. But when I want to go inside template, it doesn't show any.

My code in template

<img src="{{ post.author.pic }}" />

and in model author :

pic = models.ImageField(upload_to = func.upload_location, null = True, blank = True)
david
  • 3,225
  • 9
  • 30
  • 43
  • Possible duplicate of [How to get an ImageField URL within a template?](https://stackoverflow.com/questions/8850535/how-to-get-an-imagefield-url-within-a-template) – Selcuk Aug 01 '18 at 00:34

1 Answers1

-1

use this

{{ post.author.pic.url }}

Pankaj78691
  • 354
  • 2
  • 7