如何解决查表,通过用户传进来数据进行返回相应的数据,不同的表,名字是不同,因此应该在实例化的时候做手脚
页面表头,list_play循环肯定不行,原因里面有函数,此外如果要中文标题也不好使,中文转换难,但是里面有verbose_name
但是字段就是一个实例化的对象,因此可以通过他取值
book._meta.get_field("price"),拿到字段对象
a标签怎么添加路径怎么添加
在for循环的时候把对象
def add_0(self,obj): # 这里还可以传方法
return mark_safe("<a href='%s/add/'>添加</a>"%obj.pk) 这种方式会出新重复拼接情况
反向解析
header=False
函数的缺省参数:
语法:
def 函数名 (形参名1=默认实参1, 形参2=默认实参2)
语句块
说明:
缺省参数必须从右至左依次存在的,如果一个参数有缺省参数,
则右侧的所有参数都必须有缺省参数