django教程

双下划线查询
__exact         #精确等于 like ‘aaa’
__iexact        #精确等于 忽略大小写 ilike ‘aaa’
__contains    #包含 like ‘%aaa%’
__icontains   #包含 忽略大小写 ilike ‘%aaa%’,但是对于sqlite来说,contains的作用效果等同于icontains。
__gt              #大于
__gte           #大于等于
__lt              #小于
__lte            #小于等于
__in             #存在于一个list范围内
__startswith    #以…开头
__istartswith   #以…开头 忽略大小写
__endswith     #以…结尾
__iendswith   #以…结尾,忽略大小写
__range        #在…范围内
__year          #日期字段的年份
__month      #日期字段的月份
__day          #日期字段的日
__isnull=True/False

关联其它App的表时报错:
SystemCheckError: System check identified some issues:
ERRORS:
stationery.Stand.userinfos: (fields.E300) Field defines a relation with model 'Userinfo', which is either not installed, or is abstract.
stationery.Stand.userinfos: (fields.E307) The field stationery.Stand.userinfos was declared with a lazy reference to 'stationery.userinfo', but app 'stationery' doesn't provide model 'userinfo'.
stationery.Stand_userinfos.userinfo: (fields.E307) The field stationery.Stand_userinfos.userinfo was declared with a lazy reference to 'stationery.userinfo', but app 'stationery' doesn't provide model 'userinfo'.

from car.models import Userinfo
#错误关联方式
userinfos=models.ManyToManyField(to='Userinfo')
#正确关联方式
userinfos=models.ManyToManyField(to=Userinfo)

 

参考链接:
      http://www.cnblogs.com/yuanchenqi/articles/7690561.html            #web框架,http协议介绍
      http://www.cnblogs.com/yuanchenqi/category/1050267.html          #django框架相关
      https://www.cnblogs.com/sss4/p/7070942.html                                #django_ORM操作
      https://code.ziqiangxuetang.com/django/django-tutorial.html           #django教程
      http://www.liujiangblog.com/course/django/2                                    #django教程
      http://www.cnblogs.com/chenxuming/p/9410709.html#_label0_1    #ORM字段和字段参数
      https://yiyibooks.cn/xx/Django_1.11.6/index.html                            #django1.11.6中文文档
      https://www.django.cn/course/course-2.html
      https://www.cnblogs.com/xiaoyuanqujing
      http://www.cnblogs.com/linhaifeng/articles/6113086.html
      http://www.cnblogs.com/alex3714/articles/5765046.html

posted @ 2018-09-27 11:32  風£飛  阅读(240)  评论(0编辑  收藏  举报