第一个网站

1字段

null                数据库中字段是否可以为空
    db_column           数据库中字段的列名
    default             数据库中字段的默认值
    primary_key         数据库中字段是否为主键
    db_index            数据库中字段是否可以建立索引
    unique              数据库中字段是否可以建立唯一索引
    unique_for_date     数据库中字段【日期】部分是否可以建立唯一索引
    unique_for_month    数据库中字段【月】部分是否可以建立唯一索引
    unique_for_year     数据库中字段【年】部分是否可以建立唯一索引

    verbose_name        Admin中显示的字段名称
    blank               Admin中是否允许用户输入为空
    editable            Admin中是否可以编辑
    help_text           Admin中该字段的提示信息
    choices             Admin中显示选择框的内容,用不变动的数据放在内存中从而避免跨表操作
                        如:gf = models.IntegerField(choices=[(0, '何穗'),(1, '大表姐'),],default=1)

    error_messages      自定义错误信息(字典类型),从而定制想要显示的错误信息;
                        字典健:null, blank, invalid, invalid_choice, unique, and unique_for_date
                        如:{'null': "不能为空.", 'invalid': '格式错误'}

    validators          自定义错误验证(列表类型),从而定制想要的验证规则
                        from django.core.validators import RegexValidator
                        from django.core.validators import EmailValidator,URLValidator,DecimalValidator,\
                        MaxLengthValidator,MinLengthValidator,MaxValueValidator,MinValueValidator
                        如:
                            test = models.CharField(
                                max_length=32,
                                error_messages={
                                    'c1': '优先错信息1',
                                    'c2': '优先错信息2',
                                    'c3': '优先错信息3',
                                },
                                validators=[
                                    RegexValidator(regex='root_\d+', message='错误了', code='c1'),
                                    RegexValidator(regex='root_112233\d+', message='又错误了', code='c2'),
                                    EmailValidator(message='又错误了', code='c3'), ]
                            )

   
     icon = models.ImageField(verbose_name='图标', upload_to='./static/images/icon/', null=True, blank=True) //图片存放的路径,admind表中的名字
     detail=models.TextField(verbose_name='详细信息',null=True,blank=True)#textfield大文本
 
 

2 admin

python manage.py createsuperuser

3 数据库权重

def fetch_notice_list():
    """ 获取最新公告
    :return:
    """
    recruit_list = models.Notice.objects.filter(status=1).order_by('-weight').values('id', 'title', 'content')[0:3]

    return recruit_list

//查着到对象先order_by  在取值  再切片

 4 动态瀑布流

css

{% load xx %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div style="width: 900px;margin: 0 auto">
    <div style="width:  300px; float: left">
         {% for row in user_list %}
             {% if forloop.counter|text:'3,1' %}
             <div >
                <img src="{{ row.src }}" style="width: 300px;height: 200px">
                <p>{{ row.name }}->{{ forloop.counter }}</p>
                <p>{{ row.summary  }}</p>
             </div>
             {% endif %}
         {% endfor %}
    </div>
    <div style="width: 300px; float: left">
       {% for row in user_list %}
           {% if forloop.counter|text:'3,2' %}
             <div >
                <img src="{{ row.src }}" style="width: 300px;height: 200px">
                <p>{{ row.name }}->{{ forloop.counter }}</p>
                <p>{{ row.summary  }}</p>
             </div>
             {% endif %}
         {% endfor %}
    </div>
    <div style="width: 300px; float: left">
        {% for row in user_list %}
          {% if forloop.counter|text:'3,0' %}
             <div >
                <img src="{{ row.src }}" style="width: 300px;height: 200px">
                <p>{{ row.name }}->{{ forloop.counter }}</p>
                <p>{{ row.summary  }}</p>
             </div>
             {% endif %}
         {% endfor %}
    </div>
</div>



</body>
</html>
View Code

自定义函数 templatetags

from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter
def text(a1,a2):
    n1,n2=a2.split(',')
    if a1 % int(n1)==int(n2) :
        return True
    return False
View Code

js实现瀑布流

    $(function () {
        eachs();
        scrollEvent()
    });

    NID=0;
    lastpostion=3;
    function eachs() {

        $.ajax(
            {
                url:"/aa.html/",
                type:'GET',
                data:{'nid':NID},
                dataType:"JSON",
                success:function (data) {
                    var datas=data.data;
                    $(datas).each(function (i,v) {
                        var eqa=(i+lastpostion+1) % 4;
                        console.log(eqa)
                        var tag=document.createElement('img');
                        tag.src='/'+v.student__pic;
                        tag.style.height=500+'px';
                        $(".content_body").children().eq(eqa).append(tag);

                        if (i+1 == datas.length){
                            NID=v.student__id;

                            lastpostion = eqa


                            }
                    })
                }
            }
        )

    }

    function scrollEvent() {

        $(window).scroll(function () {
            //文档总高度
            var docHeight = $(document).height();
            //窗口高度
            var winHeight = $(window).height();
            //
            var scro = $(window).scrollTop();

            console.log(docHeight,winHeight,scro);

            if (winHeight+ scro ==docHeight){
                eachs()
            }
        })

    }
瀑布流加滚动条
 $(function () {
        var obj =new Scroimg();
        obj.eachs();
        obj.scrollEvent();
    })

      function Scroimg(){
            this.NID=0;
            this.lastpostion=3;
            this.eachs=function () {
                var that=this;
                 $.ajax(
                {
                url:"/aa.html/",
                type:'GET',
                data:{'nid':that.NID},
                dataType:"JSON",
                success:function (data) {
                    var datas=data.data;
                    $(datas).each(function (i,v) {
                        var eqa=(i+that.lastpostion+1) % 4;
                        console.log(eqa);
                        var tag=document.createElement('img');
                        tag.src='/'+v.student__pic;
                        tag.style.height=500+'px';
                        $(".content_body").children().eq(eqa).append(tag);

                        if (i+1 == datas.length){
                            that.ID=v.student__id;

                            that.lastpostion = eqa


                                        }
                                })
                            }
                        }
                    )

                };

            this.scrollEvent=function () {
                var that=this;

                $(window).scroll(function () {
                    //文档总高度
                    var docHeight = $(document).height();
                    //窗口高度
                    var winHeight = $(window).height();
                    //
                    var scro = $(window).scrollTop();

                    console.log(docHeight,winHeight,scro);

                    if (winHeight+ scro ==docHeight){
                        that.eachs()
                    }

            })



             };
        }
面向对象方式(推荐)
$.ajax(
            {
                url:"/students.html/",
                type:'POST',
                dataType:"JSON",
                success:function (data) {
                    var datas=data.data;
                    $(datas).each(function (i,v) {
                        {#console.log(v.student__pic)#}
                        var eqa=i % 4;
                        {#console.log(eq)#}
                        var tag=document.createElement('img');
                        tag.src='/'+v.student__pic;
                      
                        tag.style.height=200+'px'
                        
                        $(".content_body").children().eq(eqa).append(tag)
                    })
                }
            }
        )
唯一方式,其他忽略
 {% load xx %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/static/js/jquery-2.1.4.min.js"></script>
</head>
<body>

<div style="width: 900px;margin: 0 auto">
    <div class="div1" style="width:  300px; float: left"></div>
    <div class="div2" style="width: 300px; float: left">

    </div>
    <div class="div3" style="width: 300px; float: left">

    </div>
</div>
<script>

      $.ajax({
               url:"/flow/",
               type:"POST",
               success:function(data) {
                   var datas = JSON.parse(data)

                   for (var key in datas) {

                      if( (key+1)%3==1){
                       var div = document.createElement('div');
                       var img=document.createElement('img');
                       img.src=datas[key].src;
                       img.style.width=300+'px';
                       img.style.height=200+'px';
                       var p1=document.createElement('p');
                       p1.innerHTML=datas[key].name
                       var p2=document.createElement('p');
                       p2.innerHTML=datas[key].summary
                       div.append(img)
                          div.append(p1)
                          div.append(p2)
                       $(".div1").append(div)
                      } else if ((key+1)%3==2){
                          var div = document.createElement('div');
                       var img=document.createElement('img');
                       img.src=datas[key].src;
                       img.style.width=300+'px';
                       img.style.height=200+'px';
                       var p1=document.createElement('p');
                       p1.innerHTML=datas[key].name
                       var p2=document.createElement('p');
                       p2.innerHTML=datas[key].summary
                       div.append(img)
                          div.append(p1)
                          div.append(p2)
                       $(".div2").append(div)
                      }else {
                          var div = document.createElement('div');
                       var img=document.createElement('img');
                       img.src=datas[key].src;
                       img.style.width=300+'px';
                       img.style.height=200+'px';
                       var p1=document.createElement('p');
                       p1.innerHTML=datas[key].name
                       var p2=document.createElement('p');
                       p2.innerHTML=datas[key].summary
                       div.append(img)
                          div.append(p1)
                          div.append(p2)
                       $(".div3").append(div)
                      }




            }


               }})



</script>


</body>
</html>
View Code
 {% load xx %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/static/js/jquery-2.1.4.min.js"></script>
</head>
<body>

<div style="width: 900px;margin: 0 auto">
    <div class="div1" style="width:  300px; float: left">
    </div>
    <div class="div2" style="width: 300px; float: left">

    </div>
    <div class="div3" style="width: 300px; float: left">

    </div>
</div>
<script>

      $.ajax({
               url:"/flow/",
               type:"POST",
               success:function(data) {
                   var datas = JSON.parse(data)

                   for (var key in datas) {
                           var div = document.createElement('div');
                       var img=document.createElement('img');
                       img.src=datas[key].src;
                       img.style.width=300+'px';
                       img.style.height=200+'px';
                       var p1=document.createElement('p');
                       p1.innerHTML=datas[key].name
                       var p2=document.createElement('p');
                       p2.innerHTML=datas[key].summary
                       div.append(img)
                          div.append(p1)
                          div.append(p2)

                       if( (key+1)%3==1){ $(".div1").append(div) }
                       else    if( (key+1)%3==2){ $(".div2").append(div) }
                       else {$(".div3").append(div)}
                   }


               }})



</script>


</body>
</html>
View Code

 默认是能是字典,加safe=false可以返回列表

5

<strong> 标签和 <em> 标签一样,用于强调文本,但它强调的程度更强一些。
overflow:hidden 给漂浮的div设置背景颜色

<div style="clear:both"></div> 或者在当前div最底层加这一句

6

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>

        .div3 {
            height: 300px;
            top: 65%;
            color: white;
            width: 100%;
            /*margin-top: -68px;*/
            text-align: center;
            visibility: hidden; #看不见
            position: absolute;
            opacity: 100%;
            transition: all 0.2s ease-in-out; 渐变
        }

        .div2:hover .div3 {
            top: 30%;
            visibility: visible; 看得见
        }

        .div2:hover {
            background-color: black;
        }

        .div2:hover img {
            opacity: 0.5
        }


    </style>
</head>
<body>

<div class="div1">
    <div class=div2 style="width: 300px; height: 300px; float: left; position: relative;">
        <img src="1.jpg" style="width: 300px; height: 300px;">
        <div class="div3">

            <span>John Doe</span>
            <small>Developer</small>
            <p>Lorem ipsum dolor sit ame con sectetur adipisci ng e lit.</p>

        </div>
    </div>

</div>


</body>
</html>
hover

 7

text-align: center; 文本居中

8 js 实现标签的现实和隐藏

 //      $(function () {
//            $('dt').click(function () {

//                if ($(this).next().is(':visible')) {
                    $(this).next().hide()
//              }
//
//                else {
//                   {#$(this).next().css('display', 'block')#}
                    $(this).next().show()
//               }
//           })
//      });

$("#id").show()表示display:block,
$("#id").hide()表示display:none;

8

<dl>
   <dt>计算机</dt>
   <dd>用来计算的仪器 ... ...</dd>
   <dt>显示器</dt>
   <dd>以视觉方式显示信息的装置 ... ...</dd>
</dl>

9

@register.simple_tag()
def cl_tag(obj,arg_dict,key):
    from django.urls import reverse
    if key =='cg_id':
        url = reverse('vvv', kwargs={'cg_id': obj.id, 'lv_id': arg_dict.get('lv_id')})

        if str(obj.id) == arg_dict.get('cg_id'):
            # 获取当前URL
            tag = "<a class='active' href=%s>%s</a>" % (url, obj.name)

        else:
            tag = "<a href=%s>%s</a>" % (url, obj.name)

    elif key =='lv_id':

        url = reverse('vvv', kwargs={'cg_id': arg_dict.get('cg_id'), 'lv_id': obj.id})

        if str(obj.id) == arg_dict.get('lv_id'):
            tag = "<a class='active' href='%s'>%s</a>" % (url, obj.name)

        else:
            tag = "<a href='%s'>%s</a>" % (url, obj.name)
    return mark_safe(tag,)

      
//组合搜索
{% for item in category_list %}
            {% cl_tag item arg_dict 'cg_id'%}
{% endfor %}
组合搜索html
def video(request,*args, **kwargs): // url的值都在 kwargs 键值对
    condition = {}
    for k,i in kwargs.items():
        if i =='0':
            pass
        else:
            condition[k]=i
//如果有值,就把k和值 添加到字典

    category_list = models.Category.objects.all()
    level_list = models.Level.objects.all()
    result = models.Video.objects.filter(**condition)//根据字典的值联合搜索

    return render(request,'video.html',{
        'category_list': category_list,
        'level_list': level_list,
        'result': result,
        'arg_dict': kwargs,

    })
组合搜索views
urlpatterns = [
re_path(r'^video-(?P<cg_id>\d+)-(?P<lv_id>\d+).html', views.video,name='vvv'),]
url部分

10

obj=models.Direction.objects.get(id=kwargs.get('dr_id'))
temp=obj.d_2_c.all().values_list('id')
//<QuerySet [(3,), (4,), (5,)]>
temp=list(zip(*temp))[0]
//(3, 4, 5)
//日本
 // condition['cg_id__in']=cg_id_list
  //  a=models.Video.objects.filter(**condition)
//a=models.Video.objects.filter(cg_id__in=(1,2,3)) 正常查询
 
a=models.Category.objects.filter(direction=1).values_list('id')
        print(a)
        //通过当前这个表关联的direction=1的结果
        obj = models.Direction.objects.get(id=kwargs.get('dr_id'))
        temp = obj.d_2_c.all().values_list('id')
        print(temp)
         //通过get获得id=x的所有对象,  再通过这个对象.d_2_c.all()拿到所有的绑定的id

11

status_list=list( map(lambda x:{'id':x[0],'name':x[1]},models.Video.status_choice)) //把后面的列表的每一个元素拿出来去函数
//((1, '下线'), (2, '上线'))
//[{'id': 1, 'name': '下线'}, {'id': 2, 'name': '上线'}]

 

 12 

 

15 反向生成url

html生成
//re_path('^video-(?P<direction_id>\d+)-(?P<classification_id>\d+)-(?P<level_id>\d+).html/$',views.video, name='video'),
//<a class="active" href="{% url 'video'  direction_id=kwargs.direction_id classification_id=foo.id  level_id=kwargs.level_id  %}">{{ foo.name }}</a>


dpython生成
//   from django.urls import reverse
url = reverse('vvv2', kwargs={'dr_id':arg_dict.get('dr_id'),'cg_id':arg_dict.get('cg_id'), 'lv_id':obj.id})

16 组合索索 1对1 

    <div class="condition">
        <h1>筛选</h1>
        <div>
            {% if kwargs.classification_id == 0 %}
                <a class="active" href="video-0-{{ kwargs.level_id }}-{{ kwargs.status }}.html">全部</a>
            {% else %}
                <a  href="/video-0-{{ kwargs.level_id }}-{{ kwargs.status }}.html">全部</a>
            {% endif %}
            {% for item in class_list %}
                {% if item.id == kwargs.classification_id %}
                    <a class="active" href="video-{{ kwargs.classification_id }}-{{ kwargs.level_id }}-{{ kwargs.status }}.html">{{ item.name }}</a>

                {% else %}
                    <a  href="video-{{ item.id  }}-{{ kwargs.level_id }}-{{ kwargs.status }}.html">{{ item.name }}</a>

                {% endif %}

            {% endfor %}
        </div>
        <div>
            {% if kwargs.level_id == 0 %}
                <a class="active" href="/video-{{ kwargs.classification_id }}-0-{{ kwargs.status }}.html">全部</a>
            {% else %}
                <a href="/video-{{ kwargs.classification_id }}-0-{{ kwargs.status }}.html">全部</a>
            {% endif %}

            {% for item in level_list %}
                {% if item.id == kwargs.level_id %}
                    <a href="/video-{{ kwargs.classification_id }}-{{ item.id }}-{{ kwargs.status }}.html" class="active">{{ item.title }}</a>
                {% else %}
                    <a href="/video-{{ kwargs.classification_id }}-{{ item.id }}-{{ kwargs.status }}.html">{{ item.title }}</a>
                {% endif %}
            {% endfor %}
        </div>
        <div>
            {% if kwargs.status == 0 %}
                <a class="active" href="/video-{{ kwargs.classification_id }}-{{ kwargs.level_id }}-0.html">全部</a>
            {% else %}
                <a href="/video-{{ kwargs.classification_id }}-{{ kwargs.level_id }}-0.html">全部</a>
            {% endif %}
         {% for item in status_list %}

                {% if item.id == kwargs.status %}
                    <a class="active" href="/video-{{ kwargs.classification_id }}-{{ kwargs.level_id }}-{{ item.id }}.html">{{ item.name }}</a>
                {% else %}
                    <a href="/video-{{ kwargs.classification_id }}-{{ kwargs.level_id }}-{{ item.id }}.html">{{ item.name }}</a>
                {% endif %}
            {% endfor %}
        </div>

    </div>
    <div>
        <h1>结果</h1>
        <div>
            {% for row in video_list %}
                <div>{{ row.title }}</div>
            {% endfor %}
        </div>
    </div>
html
def video(request,*args,**kwargs):


    condition = {
        # 'level_id': 0,
        # 'classification_id': 0,
    }
    for k,v in kwargs.items():
        temp = int(v)
        kwargs[k] = temp
        if temp:
            condition[k] = temp

    class_list = models.Classification.objects.all()
    level_list = models.Level.objects.all()
    video_list = models.Video.objects.filter(**condition)


    status_list=list( map(lambda x:{'id':x[0],'name':x[1]},models.Video.status_choice))
    print(status_list)

    """
    status_choice = (
        (1, '下线'),
        (2, '上线'),
    )
    """
    status_list = list(map(lambda x:{'id':x[0],'name':x[1]},models.Video.status_choice))

    video_list = models.Video.objects.filter(**condition)

    return render(
        request,
        'video.html',
        {
            'class_list':class_list,
            'level_list':level_list,
            'status_list':status_list,
            'kwargs':kwargs,
            'video_list':video_list,
        }
    )
video

17 组合搜索多对多

re_path('^videos-(?P<direction_id>\d+)-(?P<classification_id>\d+)-(?P<level_id>\d+).html/$',views.video, name='video'),
url
def video(request,*args,**kwargs):

    for k,v in kwargs.items():
        v=int(v)
        kwargs[k]=v
    condition = { }
    direction_id = kwargs.get('direction_id')
    classification_id = kwargs.get('classification_id')
    level_id = kwargs.get('level_id')
    direction_list=Direction.objects.all()
    level_list=Level.objects.all()
    if direction_id==0:
        #方向是0
        class_list=Classification.objects.all() #页面显示的class全部列表
        if classification_id == 0:
            pass #什么都不做 result=Video.objects.filter()会获得所有Video数据
        else:
            condition['classification_id']=classification_id #result=Video.objects.filter('classification_id'=classification_i)会获得所有Video数据

    else:
        team=Direction.objects.filter(id=direction_id).first() #获取id==1direction_id的对象
        class_list=team.classification.all() # 获取Direction绑定的classification列表
        print(class_list)

        teams = team.classification.all().values_list('id')
        # 获取Direction绑定的classification列表的id

        if not teams:
            class_list_id = []
        else:
            class_list_id = list(zip(*teams))[0]
        if classification_id ==0:
            condition['classification_id__in']=class_list_id
        else:
            if classification_id in class_list_id:
                condition['classification_id']=classification_id
            else:
                condition['classification_id']=class_list_id
                kwargs['classification_id']=0  #当html前端选择时候,使其等于0


    result=Video.objects.filter(**condition)


    return render(request,'home/videos.html',{'direction_list':direction_list,
                                              'class_list':class_list,
                                              'level_list':level_list,
                                              'result':result,
                                              'kwargs':kwargs
                                              })
video
<div class="contents" style="overflow:hidden">
        <div class="condition">

            <div>
                {% if kwargs.direction_id == 0 %}
                    <a class="active" href="/video-0-{{ kwargs.classification_id}}-{{ kwargs.level_id }}.html">全部</a>
                {% else %}
                    <a  href="/video-0-{{ kwargs.classification_id}}-{{ kwargs.level_id }}.html">全部</a>


                {% endif %}
                {% for foo in direction_list %}
                    {% if foo.id == kwargs.direction_id %}
                        <a class="active" href="/video-{{ kwargs.direction_id }}-{{ kwargs.classification_id}}-{{ kwargs.level_id }}.html">{{ foo.name }}</a>
                    {% else %}
                        <a href="/video-{{ foo.id }}-{{ kwargs.classification_id}}-{{ kwargs.level_id }}.html">{{ foo.name }}</a>
                    {% endif %}
                {% endfor %}
            </div>

            <div>

                {% if kwargs.classification_id == 0 %}
                    <a class="active" href="{% url 'video' direction_id=kwargs.direction_id classification_id=0 level_id=kwargs.level_id %}">全部</a>
                {% else %}
                    <a href="{% url 'video' direction_id=kwargs.direction_id classification_id=0 level_id=kwargs.level_id %}">全部</a>
                {% endif %}
                {% for foo in class_list %}
                    {% if foo.id == kwargs.classification_id %}

                        <a class="active" href="{% url 'video'  direction_id=kwargs.direction_id classification_id=foo.id  level_id=kwargs.level_id  %}">{{ foo.name }}</a>

                    {% else %}
                        <a href="{% url 'video' direction_id=kwargs.direction_id classification_id=foo.id level_id=kwargs.level_id %}">{{ foo.name }}</a>
                    {% endif %}

                {% endfor %}
            </div>



            <div>
                {% if kwargs.level_id == 0 %}
                    <a class="active" href="/video-{{ kwargs.direction_id  }}-{{ kwargs.classification_id }}-0.html">全部</a>
                {% else %}
                    <a  href="/video-{{ kwargs.direction_id  }}-{{ kwargs.classification_id }}-0.html">全部</a>
                {% endif %}
                {% for foo in level_list %}
                    {% if foo.id == kwargs.level_id %}
                        <a class="active" href="{% url 'video' direction_id=kwargs.direction_id  classification_id=kwargs.classification_id level_id=foo.id %}" >{{ foo.title }}</a>
                    {% else %}
                        <a href="{% url 'video' direction_id=kwargs.direction_id  classification_id=kwargs.classification_id level_id=foo.id %}" >{{ foo.title }}</a>

                    {% endif %}
                {% endfor %}
            </div>

        </div>

        <h1>查询结果</h1>
        <div class="content">
            {% for row in result %}
                <div style="width: 100px;height: 260px;float: left;">
                    <img style="width: 100px;height: 150px;" src="/{{ row.img }}">
                    <p>{{ row.title }}</p>
                    <p>{{ row.summary }}</p>
                </div>
            {% endfor %}
        </div>

    </div>
html
class  Direction(models.Model):
    '''方向类 方向:自动化,测试,运维,前端'''

    name=models.CharField(verbose_name='方向名称',max_length=32)
    classification=models.ManyToManyField('Classification')
    class Meta:
        db_table=' Direction'
        verbose_name_plural = '方向'
    def __str__(self):
        return self.name

class Classification(models.Model):
    """分类:Python Linux JavaScript OpenStack Node.js"""

    name = models.CharField(verbose_name='专业', max_length=32)
    class Meta:
        db_table='Classification'
        verbose_name_plural = '分类'
    def __str__(self):
        return self.name
class Level(models.Model):
    '''级别难度'''
    title = models.CharField(verbose_name='等级', max_length=32)

    class Meta:
        db_table = 'level'
        verbose_name_plural = '难度'
    def __str__(self):
        return self.title

class Video(models.Model):
    status_choice=((1,'上线'),(2,'下线'))
    status = models.IntegerField(verbose_name='状态', choices=status_choice, default=1)
    weight = models.IntegerField(verbose_name='权重(按从大到小排列)', default=0)
    title = models.CharField(verbose_name='标题', max_length=32)
    summary = models.CharField(verbose_name='简介', max_length=32)
    img = models.ImageField(verbose_name='图片', upload_to='./static/images/Video/')
    href = models.CharField(verbose_name='视频地址', max_length=256)
    create_date = models.DateTimeField(auto_now_add=True)
    level = models.ForeignKey(Level, on_delete=models.CASCADE)
    classification = models.ForeignKey(Classification, null=True, blank=True, on_delete=models.CASCADE)
    class Meta:
        db_table = 'Video'
        verbose_name_plural = '视频'
    def __str__(self):
        return self.title
modelos

18智能客服 bootstrap

 <!-- 智能客服开始 -->
     <div style="position: fixed;right: 5px;top: 40%;">
            <a type="button" role="button" tabindex="0" title="在线客服" data-html="true" data-trigger="focus" data-container="body" data-toggle="popover" data-placement="left"
               data-content='<div style="margin:5px 0px;">
                <a target="_blank"
                href="http://wpa.qq.com/msgrd?v=3&amp;uin=424662508&amp;site=qq&amp;menu=yes">
               <img border="0" src="/static/images/qq.png" alt="联系客服" title="联系客服"></a></div>'>
              <img style="width: 50px;" src="/static/images/zhineng.gif">
           </a>
    </div>

    <!-- 智能客服结束 -->
    <script type="text/javascript" src="/static/js/jquery-2.1.4.min.js"></script>
    <script type="text/javascript" src="/static/plugins/bootstrap/js/bootstrap.min.js"></script>
    <script>
        $(function(){
            $("[data-toggle='popover']").popover();
        });

    </script>

 19

                            <dl>
                                <dt>
                                    <b>请将简历发送至招聘邮箱</b>
                                    <a href="#" style="background-color: #ffae2c">1174173985@qq.com</a>
                                    <b> 标题请注明"应聘+职位+姓名</b>
                                </dt>
                            </dl>
//#hrs{
              width: 30px; border-bottom: 2px olivedrab solid;position:relative; left:50%;margin-top: 15px
            }
//cursor: pointer;

20

 //$("#three").on('click','li',function () {}
/点击的时候再绑定, id=three下面的li标签, 绑定事件

21

   function show(self) {

            $(self).addClass('color').siblings().removeClass('color')

            var a = $(self).attr('one');
            console.log(a);
    
            $("#" + a).removeClass('hides').siblings().addClass("hides")

        }

// 标题设置 attr  aa=bb  aa=cc

//内容设置 id 等于 bb    id等于cc

//  拿到自身attr  one的值   

//字符串拼接, 寻找 #id = one的值

22网站插入地图

http://api.map.baidu.com/lbsapi/creatmap/index.html

 

posted @ 2019-01-07 18:17  new边城  阅读(140)  评论(0)    收藏  举报