I am not able to upload image.
here is my models.py
class Post(models.Model):
author = models.ForeignKey('auth.User')
title = models.CharField(max_length=200)
text = models.TextField()
image = models.FileField(upload_to = 'post/static/images/' , null= True, blank= True)
created_date = models.DateTimeField(default=timezone.now)
published_date = models.DateTimeField(blank=True, null=True)
def publish(self):
self.published_date = timezone.now()
self.save()
def __str__(self):
return self.title
the image is not getting uploaded to 'post/static/images/'
here is the template for uploading the image
{% if post.media %}
<img src="{{ post.image.url }}" class="img-responsive" />
{% endif %}