Django - Display ImageField

后端 未结 3 999
孤街浪徒
孤街浪徒 2020-12-01 20:48

i just start to use django and i haven\'t found a lot of info on how to display an imageField, so i made this:

models.py

class Car(models.Model):
           


        
3条回答
  •  半阙折子戏
    2020-12-01 21:16

    You can also make use of the Static URL in Settings.py. Make a directory for example "Uploads", in the Static directory of your app. Also change this in your model in models.py.

    Use the following code:

    
    

提交回复
热议问题