Django background management system article photo video file upload front-end page

Django background management system article photo file upload

If you need to install the operating environment or remote debugging, see the personal QQ business card at the bottom of the article, and professional and technical personnel will assist remotely!

foreword

This blog writes code for <<Django background management system article photo file upload>>, the code is neat, regular and easy to read. The first choice for learning and application recommendation.

Article directory

1. Required tool software

2. Use steps

1. Model introduction

2. Front-end page

3. Running results

3. Online assistance

1. Required tool software

1. Pycharm,

2. Win10, Python

2. Use steps

1. Model introduction

The code is as follows (example):

# coding:utf-8
from django.db import models

# Create your models here.


class Article(models.Model):  
    title = models.CharField(u'标题', max_length=256)
    data1 = models.CharField(u'数据1', max_length=256)
    file = models.FileField(u'文件', upload_to="files/") 
    img = models.ImageField(u'相片', upload_to='imgs/')
    content = models.TextField(u'内容')

    pub_date = models.DateTimeField(u'发表时间', auto_now_add=True, editable=True)
    update_time = models.DateTimeField(u'更新时间', auto_now=True, null=True)

    def __str__(self):  # 在Python3中用 __str__ 代替 __unicode__
        return self.title

2. Front-end page display

The code is as follows (example):

{% load static %}
<link rel="stylesheet" href="{% static 'booksales/economics.css' %}" rel="external nofollow" >
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
<title>xxxxxx</title>
<base target=_blank>
<style></style>

</head>

<body>
<DIV ID="outermostframe">
    <DIV ID="pgheader1";><a ID="pgheader2" href="">欢迎光临</a></DIV>

    <DIV ID="secondframe">

        <DIV class="huitechlogoframe">
            <span id="huitechlogo"><img width="150" height="70" src="../static/booksales/img/moon4.png"></span>
        </DIV>

       
        <div id="demo"> 
            <div id="indemo"> 
                <div id="demo1"> 

                    <a href="#"><img width="130" height="110" src="../static/booksales/img/commonphoto/1.jpg" style="border-radius:5px" /></a>
                    <a href="#"><img width="130" height="110" src="../static/booksales/img/commonphoto/2.jpg" style="border-radius:5px" /></a>
                    <a href="#"><img width="130" height="110" src="../static/booksales/img/commonphoto/3.jpg" style="border-radius:5px" /></a>
                    <a href="#"><img width="130" height="110" src="../static/booksales/img/commonphoto/4.jpg" style="border-radius:5px" /></a>
                    <a href="#"><img width="130" height="110" src="../static/booksales/img/commonphoto/5.jpg" style="border-radius:5px" /></a>
                    <a href="#"><img width="130" height="110" src="../static/booksales/img/commonphoto/6.jpg" style="border-radius:5px" /></a>
                </div> 
                <div id="demo2"></div> 
            </div> 
        </div> 
        <script> 
         
        var speed=15;
        var tab=document.getElementById("demo");
        var tab1=document.getElementById("demo1"); 
        var tab2=document.getElementById("demo2"); 
        tab2.innerHTML=tab1.innerHTML; 
        function Marquee()
            { 
            if(tab2.offsetWidth-tab.scrollLeft<=0) 
            tab.scrollLeft-=tab1.offsetWidth 
            else
                { 
                tab.scrollLeft++; 
                } 
            } 
        var MyMar=setInterval(Marquee,speed); 
        tab.onmouseover=function() {clearInterval(MyMar)}; 
        tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)}; 
        --> 
        </script> 
        

    </DIV>

    <div id="nav">
      <ul ID="ul-1" >
        <li ID="li-1" ><a ID="a" href="./economicsWeb" target="_self">首页</a></li>
        <li ID="li-1"><a ID="a" href="./economicsWeb" target="_self"  style="background-color: rgb(255,68,0);">经济学</a></li>
        <li ID="li-1" ><a ID="a" href="./economicsWeb" target="_self">推理学</a></li>
        <li ID="li-1"><a ID="a" href="./economicsWeb" target="_self">心理学</a></li>
        <li ID="li-1"><a ID="a" href="./economicsWeb" target="_self">历史名著</a></li>
      </ul>
    </div>

    <div style="width:1220px;height: 900px;margin-left:0px; margin-top:-120px;border-color:rgb(204,204,204);border-style:solid;  border-width: 0px;border-radius:5px;position:static;float:left;">
        

        <div style="width:950px;height: 900px;margin-left:0px; margin-top:0px;border-color:rgb(204,204,204);border-style:solid;  border-width: 2px;border-radius:5px;position:static;float:left;">
           
               
            <div style="width:1120px;height:680px;margin-left:0px; margin-top:20px;border-color:rgb(204,204,204);border-style:none; position:static;float:left;">

                
                <div style="width:1120px;height:380px;margin-left:0px; margin-top:0px;border-color:rgb(204,204,204);border-style:solid;  border-width: 0px;position:static;float:left;">
                    <div class="mouse" style="background:none;width:220px;height:380px;border-style:solid;  border-width: 1px;position:static; left:500px; top:20px; float:left;margin-left:0px;">
                        <A href="http://a.com/" target="_blank" >
                            <IMG width="220" height="220" title="a" alt="a" src="../static/booksales/img/economics/photo/homephoto/1.jpg" style=" border-radius: 0px;position:static;text-decoration:none;"></IMG>
                        </A>
                        <p style="position:static;text-align:left;margin-left:5px;margin-top:10px;font-size: 18px;color:#FF4400;font-weight:bold;line-height:1;font-family:Microsoft YaHei;width:180px;">¥15.00</p>
                        <A href="./purchase.html" target="_blank" style="text-decoration:none;"> 
                            <p style="position:static;text-align:right;margin-right:5px;margin-top:-12px;font-size: 13px;color:#FF4400;font-weight:bold;line-height:1;font-family:Microsoft YaHei; ">进入付款页订购</p>
                        </A>
                        <A href="http://a.com/" target="_blank" style="text-decoration:none;"> 
                            <p style="position:static;text-align:left;margin-left:5px;margin-top:15px;font-size: 13px;color:#000500;font-weight:normal;line-height:1;font-family:Microsoft YaHei; width:220px;">经济学图书 </p>
                        </A>
                        <p style="position:static;text-align:left;margin-left:5px;margin-top:40px;font-size: 13px;color:#0874D6;font-weight:normal;line-height:1;font-family:Microsoft YaHei; width:220px; ">=海纳图书馆</p>
                        <p style="position:static;text-align:right;margin-right:5px;margin-top:-12px;font-size: 13px;color:#000500;font-weight:normal;line-height:1;font-family:Microsoft YaHei;border:none;target="_blank"">上海</p>
                        <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=905733049&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:905733049:52" alt="点击这里给我发消息" title="点击这里给我发消息" style="position:static; margin-left:190px;margin-top:10px;position:static;float:left"/></a>
                    </div>

                    <div class="mouse" style="background:none;width:220px;height:380px;border-style:solid;  border-width: 1px;position:static; left:600px; top:20px;float:left; margin-left:20px;">
                       <A href="http://a.com/" target="_blank" >
                            <IMG width="220" height="220" title="a" alt="a" src="../static/booksales/img/economics/photo/homephoto/2.jpg" style=" border-radius: 0px;position:static;text-decoration:none;"></IMG>
                        </A>
                        <p style="position:static;text-align:left;margin-left:5px;margin-top:10px;font-size: 18px;color:#FF4400;font-weight:bold;line-height:1;font-family:Microsoft YaHei;width:180px;">¥15.00</p>
                        <A href="./purchase.html" target="_blank" style="text-decoration:none;"> 
                            <p style="position:static;text-align:right;margin-right:5px;margin-top:-12px;font-size: 13px;color:#FF4400;font-weight:bold;line-height:1;font-family:Microsoft YaHei; ">进入付款页订购</p>
                        </A>
                        <A href="http://a.com/" target="_blank" style="text-decoration:none;"> 
                            <p style="position:static;text-align:left;margin-left:5px;margin-top:15px;font-size: 13px;color:#000500;font-weight:normal;line-height:1;font-family:Microsoft YaHei; width:220px;">    
                                经济学图书 </p>
                        </A>
                        <p style="position:static;text-align:left;margin-left:5px;margin-top:40px;font-size: 13px;color:#0874D6;font-weight:normal;line-height:1;font-family:Microsoft YaHei; width:220px; ">=海纳图书馆</p>
                        <p style="position:static;text-align:right;margin-right:5px;margin-top:-12px;font-size: 13px;color:#000500;font-weight:normal;line-height:1;font-family:Microsoft YaHei;border:none;target="_blank"">上海</p>
                        <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=905733049&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:905733049:52" alt="点击这里给我发消息" title="点击这里给我发消息" style="position:static; margin-left:190px;margin-top:10px;position:static;float:left"/></a>
                    </div>

                    <div class="mouse" style="background:none;width:220px;height:380px;border-style:solid;  border-width: 1px;position:static; left:700px; top:20px;float:left;  margin-left:20px;">
                       <A href="http://a.com/" target="_blank" >
                            <IMG width="220" height="220" title="a" alt="a" src="../static/booksales/img/economics/photo/homephoto/3.jpg" style=" border-radius: 0px;position:static;text-decoration:none;"></IMG>
                        </A>
                        <p style="position:static;text-align:left;margin-left:5px;margin-top:10px;font-size: 18px;color:#FF4400;font-weight:bold;line-height:1;font-family:Microsoft YaHei;width:180px;">¥15.00</p>
                        <A href="./purchase.html" target="_blank" style="text-decoration:none;"> 
                            <p style="position:static;text-align:right;margin-right:5px;margin-top:-12px;font-size: 13px;color:#FF4400;font-weight:bold;line-height:1;font-family:Microsoft YaHei; ">进入付款页订购</p>
                        </A>
                        <A href="http://a.com/" target="_blank" style="text-decoration:none;"> 
                            <p style="position:static;text-align:left;margin-left:5px;margin-top:15px;font-size: 13px;color:#000500;font-weight:normal;line-height:1;font-family:Microsoft YaHei; width:220px;">    
                                经济学图书 </p>
                        </A>
                        <p style="position:static;text-align:left;margin-left:5px;margin-top:40px;font-size: 13px;color:#0874D6;font-weight:normal;line-height:1;font-family:Microsoft YaHei; width:220px; ">=海纳图书馆</p>
                        <p style="position:static;text-align:right;margin-right:5px;margin-top:-12px;font-size: 13px;color:#000500;font-weight:normal;line-height:1;font-family:Microsoft YaHei;border:none;target="_blank"">上海</p>
                        <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=905733049&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:905733049:52" alt="点击这里给我发消息" title="点击这里给我发消息" style="position:static; margin-left:190px;margin-top:10px;position:static;float:left"/></a>
                    </div>

                    <div class="mouse" style="background:none;width:220px;height:380px;border-style:solid;  border-width: 1px;position:static; left:700px; top:20px;float:left;  margin-left:20px;">
                       <A href="http://a.com/" target="_blank" >
                            <IMG width="220" height="220" title="a" alt="a" src="../static/booksales/img/economics/photo/homephoto/4.jpg" style=" border-radius: 0px;position:static;text-decoration:none;"></IMG>
                        </A>
                        <p style="position:static;text-align:left;margin-left:5px;margin-top:10px;font-size: 18px;color:#FF4400;font-weight:bold;line-height:1;font-family:Microsoft YaHei;width:180px;">¥15.00</p>
                        <A href="./purchase.html" target="_blank" style="text-decoration:none;"> 
                            <p style="position:static;text-align:right;margin-right:5px;margin-top:-12px;font-size: 13px;color:#FF4400;font-weight:bold;line-height:1;font-family:Microsoft YaHei; ">进入付款页订购</p>
                        </A>
                        <A href="http://a.com/" target="_blank" style="text-decoration:none;"> 
                            <p style="position:static;text-align:left;margin-left:5px;margin-top:15px;font-size: 13px;color:#000500;font-weight:normal;line-height:1;font-family:Microsoft YaHei; width:220px;">    
                                经济学图书</p>
                        </A>
                        <p style="position:static;text-align:left;margin-left:5px;margin-top:40px;font-size: 13px;color:#0874D6;font-weight:normal;line-height:1;font-family:Microsoft YaHei; width:220px; ">=海纳图书馆</p>
                        <p style="position:static;text-align:right;margin-right:5px;margin-top:-12px;font-size: 13px;color:#000500;font-weight:normal;line-height:1;font-family:Microsoft YaHei;border:none;target="_blank"">上海</p>
                        <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=905733049&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:905733049:52" alt="点击这里给我发消息" title="点击这里给我发消息" style="position:static; margin-left:190px;margin-top:10px;position:static;float:left"/></a>
                    </div>
                </div>

                
                <div style="width:1120px;height:380px;margin-left:0px; margin-top:30px;border-color:rgb(204,204,204);border-style:solid;  border-width: 0px;position:static;float:left;">
                    <div class="mouse" style="background:none;width:220px;height:380px;border-style:solid;  border-width: 1px;position:static; left:500px; top:20px; float:left;margin-left:0px;">
                       <A href="http://a.com/" target="_blank" >
                            <IMG width="220" height="220" title="a" alt="a" src="../static/booksales/img/economics/photo/homephoto/5.jpg" style=" border-radius: 0px;position:static;text-decoration:none;"></IMG>
                        </A>
                        <p style="position:static;text-align:left;margin-left:5px;margin-top:10px;font-size: 18px;color:#FF4400;font-weight:bold;line-height:1;font-family:Microsoft YaHei;width:180px;">¥15.00</p>
                        <A href="./purchase.html" target="_blank" style="text-decoration:none;"> 
                            <p style="position:static;text-align:right;margin-right:5px;margin-top:-12px;font-size: 13px;color:#FF4400;font-weight:bold;line-height:1;font-family:Microsoft YaHei; ">进入付款页订购</p>
                        </A>
                        <A href="http://a.com/" target="_blank" style="text-decoration:none;"> 
                            <p style="position:static;text-align:left;margin-left:5px;margin-top:15px;font-size: 13px;color:#000500;font-weight:normal;line-height:1;font-family:Microsoft YaHei; width:220px;">经济学图书</p>
                        </A>
                        <p style="position:static;text-align:left;margin-left:5px;margin-top:40px;font-size: 13px;color:#0874D6;font-weight:normal;line-height:1;font-family:Microsoft YaHei; width:220px; ">=海纳图书馆</p>
                        <p style="position:static;text-align:right;margin-right:5px;margin-top:-12px;font-size: 13px;color:#000500;font-weight:normal;line-height:1;font-family:Microsoft YaHei;border:none;target="_blank"">上海</p>
                        <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=905733049&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:905733049:52" alt="点击这里给我发消息" title="点击这里给我发消息" style="position:static; margin-left:190px;margin-top:10px;position:static;float:left"/></a>
                    </div>

                    <div class="mouse" style="background:none;width:220px;height:380px;border-style:solid;  border-width: 1px;position:static; left:600px; top:20px;float:left; margin-left:20px;">
                        <A href="http://a.com/" target="_blank" >
                       <A href="http://a.com/" target="_blank" >
                            <IMG width="220" height="220" title="a" alt="a" src="../static/booksales/img/economics/photo/homephoto/6.jpg" style=" border-radius: 0px;position:static;text-decoration:none;"></IMG>
                        </A>
                        <p style="position:static;text-align:left;margin-left:5px;margin-top:10px;font-size: 18px;color:#FF4400;font-weight:bold;line-height:1;font-family:Microsoft YaHei;width:180px;">¥15.00</p>
                        <A href="./purchase.html" target="_blank" style="text-decoration:none;"> 
                            <p style="position:static;text-align:right;margin-right:5px;margin-top:-12px;font-size: 13px;color:#FF4400;font-weight:bold;line-height:1;font-family:Microsoft YaHei; ">进入付款页订购</p>
                        </A>
                        <A href="http://a.com/" target="_blank" style="text-decoration:none;"> 
                            <p style="position:static;text-align:left;margin-left:5px;margin-top:15px;font-size: 13px;color:#000500;font-weight:normal;line-height:1;font-family:Microsoft YaHei; width:220px;">经济学图书 </p>
                        </A>
                        <p style="position:static;text-align:left;margin-left:5px;margin-top:40px;font-size: 13px;color:#0874D6;font-weight:normal;line-height:1;font-family:Microsoft YaHei; width:220px; ">=海纳图书馆</p>
                        <p style="position:static;text-align:right;margin-right:5px;margin-top:-12px;font-size: 13px;color:#000500;font-weight:normal;line-height:1;font-family:Microsoft YaHei;border:none;target="_blank"">上海</p>
                        <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=905733049&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:905733049:52" alt="点击这里给我发消息" title="点击这里给我发消息" style="position:static; margin-left:190px;margin-top:10px;position:static;float:left"/></a>
                    </div>

                    <div class="mouse" style="background:none;width:220px;height:380px;border-style:solid;  border-width: 1px;position:static; left:700px; top:20px;float:left;  margin-left:20px;">
                       <A href="http://a.com/" target="_blank" >
                            <IMG width="220" height="220" title="a" alt="a" src="../static/booksales/img/economics/photo/homephoto/7.jpg" style=" border-radius: 0px;position:static;text-decoration:none;"></IMG>
                        </A>
                        <p style="position:static;text-align:left;margin-left:5px;margin-top:10px;font-size: 18px;color:#FF4400;font-weight:bold;line-height:1;font-family:Microsoft YaHei;width:180px;">¥15.00</p>
                        <A href="./purchase.html" target="_blank" style="text-decoration:none;"> 
                            <p style="position:static;text-align:right;margin-right:5px;margin-top:-12px;font-size: 13px;color:#FF4400;font-weight:bold;line-height:1;font-family:Microsoft YaHei; ">进入付款页订购</p>
                        </A>
                        <A href="http://a.com/" target="_blank" style="text-decoration:none;"> 
                            <p style="position:static;text-align:left;margin-left:5px;margin-top:15px;font-size: 13px;color:#000500;font-weight:normal;line-height:1;font-family:Microsoft YaHei; width:220px;">    
                                经济学图书 </p>
                        </A>
                        <p style="position:static;text-align:left;margin-left:5px;margin-top:40px;font-size: 13px;color:#0874D6;font-weight:normal;line-height:1;font-family:Microsoft YaHei; width:220px; ">=海纳图书馆</p>
                        <p style="position:static;text-align:right;margin-right:5px;margin-top:-12px;font-size: 13px;color:#000500;font-weight:normal;line-height:1;font-family:Microsoft YaHei;border:none;target="_blank"">上海</p>
                        <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=905733049&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:905733049:52" alt="点击这里给我发消息" title="点击这里给我发消息" style="position:static; margin-left:190px;margin-top:10px;position:static;float:left"/></a>
                    </div>

                    <div class="mouse" style="background:none;width:220px;height:380px;border-style:solid;  border-width: 1px;position:static; left:700px; top:20px;float:left;  margin-left:20px;">
                       <A href="http://a.com/" target="_blank" >
                            <IMG width="220" height="220" title="a" alt="a" src="../static/booksales/img/economics/photo/homephoto/8.jpg" style=" border-radius: 0px;position:static;text-decoration:none;"></IMG>
                        </A>
                        <p style="position:static;text-align:left;margin-left:5px;margin-top:10px;font-size: 18px;color:#FF4400;font-weight:bold;line-height:1;font-family:Microsoft YaHei;width:180px;">¥15.00</p>
                        <A href="./purchase.html" target="_blank" style="text-decoration:none;"> 
                            <p style="position:static;text-align:right;margin-right:5px;margin-top:-12px;font-size: 13px;color:#FF4400;font-weight:bold;line-height:1;font-family:Microsoft YaHei; ">进入付款页订购</p>
                        </A>
                        <A href="http://a.com/" target="_blank" style="text-decoration:none;"> 
                            <p style="position:static;text-align:left;margin-left:5px;margin-top:15px;font-size: 13px;color:#000500;font-weight:normal;line-height:1;font-family:Microsoft YaHei; width:220px;">    
                                经济学图书 </p>
                        </A>
                        <p style="position:static;text-align:left;margin-left:5px;margin-top:40px;font-size: 13px;color:#0874D6;font-weight:normal;line-height:1;font-family:Microsoft YaHei; width:220px; ">=海纳图书馆</p>
                        <p style="position:static;text-align:right;margin-right:5px;margin-top:-12px;font-size: 13px;color:#000500;font-weight:normal;line-height:1;font-family:Microsoft YaHei;border:none;target="_blank"">上海</p>
                        <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=905733049&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:905733049:52" alt="点击这里给我发消息" title="点击这里给我发消息" style="position:static; margin-left:190px;margin-top:10px;position:static;float:left"/></a>
                    </div>
                </div>

                 
                <div style="width:200px;height:60px;margin-left:800px; margin-top:30px;border-color:rgb(204,204,204);border-style:solid;  border-width: 0px;position:static;float:left;">
                    <A href="http://a.com/" target="_blank">
                        <IMG width="130" height="56" title="a" alt="a" src="../static/booksales/img/economics/photo/more/more.png" style="position:static;float:left; border-radius: 5px;"></IMG>
                    </A>
                </div>
                 
            </div>
              
        </div>
 
        <div style="width:250px;height:900px;margin-left:10px; margin-top:0px;background: rgb(255,255,255);border-color:rgb(204,204,204);border-style:solid;  border-width: 2px;border-radius:5px;position:static;float:left; ">

        </div>

    </div>
      
    <div style="background:rgb(32,32,32);margin:1000px auto;width:1220px;height:90px; position: relative;text-align:center;padding-top: 10px">
          <P style="line-height:30px;font-size:13px;font:Microsoft YaHei;font-weight:normal;color:rgb(175,177,177); ">电话:xxxxxx    邮箱: xxxxxx </P>
          <P style="line-height:30px;font-size:13px;font:Microsoft YaHei;font-weight:normal;color:rgb(175,177,177); ">版权所有 ©xxxxxx</P>
    </div>
 
</DIV>
</body>
</html>

3. The running results are as follows

3. Online assistance:

If you need to install the operating environment or remote debugging, see the personal QQ business card at the bottom of the article, and professional and technical personnel will assist remotely!
1) Remote installation and operation environment, code debugging
2) Qt, C++, Python entry guide
3) Interface beautification
4) Software production

Articles recommended by bloggers: https://blog.csdn.net/alicema1111/article/details/123851014

Personal blog homepage: https://blog.csdn.net/alicema1111?type=blog

Click here for all blogger articles: https://blog.csdn.net/alicema1111?type=blog

Guess you like

Origin blog.csdn.net/alicema1111/article/details/129544039