Answers for "how to populate an image to template in django from views"

-1

image in django

<html>
    <head>
       {% load staticfiles %} <!-- Prepare django to load static files -->
    </head>
    <body>
        <img src={% static "image.jpg" %}>
    </body>
</html>
Posted by: Guest on September-10-2020
0

how to populate an image to template in django from views

from django.db import models
from django.contrib.auth import get_user_model
User = get_user_model()

class Image(models.Model):
    owner = models.ForeignKey(User, on_delete=models.CASCADE)
    image = models.ImageField(upload_to='Upload', height_field=None, width_field=None, max_length=100)
Posted by: Guest on August-08-2021

Code answers related to "how to populate an image to template in django from views"

Python Answers by Framework

Browse Popular Code Answers by Language