摘要:转:http://www.tuicool.com/articles/IV3meeE logging django使用python的内置模块logging来管理自己的日志,logging中四个重要的概念分别是 1、Loggers 2、Handlers 3、Filters 4、Formatters Lo
阅读全文
摘要:from django.db import models class Blog(models.Model): name = models.CharField(max_length=100) tagline = models.TextField() def __str__(self): # __uni
阅读全文
摘要:转:http://www.cnblogs.com/linxiyue/p/3667418.html
阅读全文
摘要:from django.db import models class Publisher(models.Model): name = models.CharField(max_length=30) address = models.CharField(max_length=50) city = mo
阅读全文
摘要:{% if today_is_weekend%} {% end if %} 系统会显示在这之间的内容 {% else %}标签是可选的 在python和django模板系统中,以下对象相当于布尔值的False 1、空列表。2、空元组。3、空字典。4、空字符串。5、零值。6、特殊对象None。7、对象
阅读全文
摘要:转:https://segmentfault.com/q/1010000003705677 就是一个反向关联的属性,比方说model里面定义两个class,一个是A,一个是B class A(Model): class B(Model): user = ForeignKeyField(A,relat
阅读全文
摘要:转:http://www.nanerbang.com/article/51/ get_or_create会根据条件从数据库里面查找符合条件的记录,如果没有符合条件的记录,则新创建一条记录
阅读全文
摘要:转:http://www.cnpythoner.com/post/105.html 意思就是按照条件进行查询的时候,如果查询的对象不存在的话,会抛出一个http404,比get更加友好
阅读全文