上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 33 下一页
摘要: 报错一 $ docker run hello world Unable to find image 'hello world:latest' locally Pulling repository docker.io/library/hello world K:\Docker Toolbox\dock 阅读全文
posted @ 2016-12-21 17:01 Dus 阅读(6108) 评论(0) 推荐(0) 编辑
摘要: 生成器 generator def h(): print "hello" m = yield 5 print "m:", m d = yield 12 print "d:", d print "world" 结果 c = h() c.next() hello 5 c.next() m: None 1 阅读全文
posted @ 2016-12-16 21:53 Dus 阅读(156) 评论(0) 推荐(0) 编辑
摘要: \_\_xx__ 系统定义名字 __xx 双下划线的表示的是私有类型的变量。只能是允许这个类本身进行访问了。连子类也不可以 _xx 单下划线 不能用'from moduleimport '导入 即保护类型只能允许其本身与子类进行访问。 __xx 双下划线虽然是私有,但是也是可以访问,在类里面写公有的 阅读全文
posted @ 2016-12-16 16:48 Dus 阅读(217) 评论(0) 推荐(0) 编辑
摘要: 模板 for循环 {% for athlete in athlete_list %} {{ athlete.name }} {% endfor %} if语句 {% if condition1 %} ... display 1 {% elif condiiton2 %} ... display 2 阅读全文
posted @ 2016-12-16 14:20 Dus 阅读(558) 评论(0) 推荐(0) 编辑
摘要: 一对多 建立一对多关系之后(也就是加了外键),会在字表里面多一个“外键字段_id”这个字段 查询 _ _coding:utf 8_ _ from django.db import models Create your models here. class Colors(models.Model): 阅读全文
posted @ 2016-12-13 17:47 Dus 阅读(610) 评论(0) 推荐(0) 编辑
摘要: django ORM操作 1.什么是ORM? ORM,即Object Relational Mapping(对象关系映射),它的作用是在关系型数据库和业务实体对象之间作一个映射,这样,我们在具体的操作业务对象的时候,就不需要再去和复杂的SQL语句打交道,只需简单的操作对象的属性和方法。 select 阅读全文
posted @ 2016-12-13 17:17 Dus 阅读(988) 评论(0) 推荐(0) 编辑
摘要: """ The main QuerySet implementation. This provides the public API for the ORM. """ import copy import sys import warnings from collections import Ord 阅读全文
posted @ 2016-12-13 17:15 Dus 阅读(2009) 评论(0) 推荐(0) 编辑
摘要: 字段 1、models.AutoField 自增列 = int(11) 如果没有的话,默认会生成一个名称为 id 的列,如果要显示的自定义一个自增列,必须将给列设置为主键 primary_key=True。 2、models.CharField 字符串字段 必须 max_length 参数 3、mo 阅读全文
posted @ 2016-12-13 15:49 Dus 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 视图 1、获取用户请求数据 request.GET request.POST request.FILES PS: GET:获取数据 POST:提交数据 request其他方法详解:http://djangobook.py3k.cn/appendixH/ 2、checkbox等多选的内容 reques 阅读全文
posted @ 2016-12-13 13:47 Dus 阅读(169) 评论(0) 推荐(0) 编辑
摘要: URL url(r'^detail (?P\d+) (?P\d+).html', views.detail) 会把(?P\d+)和(?P\d+)传到后台 需要在函数添加参数 def detail(request, args, kwargs): pass 第一种写法:url(r'^detail (\d 阅读全文
posted @ 2016-12-12 17:27 Dus 阅读(271) 评论(0) 推荐(0) 编辑
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 33 下一页