django 添加权限
摘要:a.models中随意增加 meta类class School(models.Model): name=models.CharField(max_length=32,unique=True) city=models.CharField(max_length=32) addr=models.CharF
阅读全文
posted @
2017-05-29 16:43
mljqqh
阅读(549)
推荐(0) 编辑
装饰器
摘要:def deco(func): def wrapper(): print("1 before myfunc() called.") func() print(" 2 after myfunc() called.") return wrapper@decodef myfun(): print("myf
阅读全文
posted @
2017-05-28 22:50
mljqqh
阅读(94)
推荐(0) 编辑
查看用户的权限
摘要:obj.user.has_perm('app1.can_del_school')True
阅读全文
posted @
2017-05-25 10:25
mljqqh
阅读(137)
推荐(0) 编辑
django分页实现
摘要:from django.shortcuts import render,render_to_responsefrom app1 import modelsfrom django.core.paginator import Paginator,EmptyPage,PageNotAnInteger# C
阅读全文
posted @
2017-05-22 10:37
mljqqh
阅读(149)
推荐(0) 编辑
admin注册数据
摘要:from django.contrib import adminfrom app1 import models admin.site.register(models.Author)admin.site.register(models.Book)admin.site.register(models.P
阅读全文
posted @
2017-05-20 03:00
mljqqh
阅读(148)
推荐(0) 编辑
django 登陆验证
摘要:a 在views中导入 from django.contrib.auth.decorators import login_required @login_required()b 在views 导入 from django.contrib.auth import authenticate def lo
阅读全文
posted @
2017-05-19 09:31
mljqqh
阅读(179)
推荐(0) 编辑
render的用法
摘要:from django.shortcuts import HttpResponse, render, redirect 导入 user_info={'name':"mlj"}return render(request,"index.html",{"user":user_info})
阅读全文
posted @
2017-05-17 09:42
mljqqh
阅读(380)
推荐(0) 编辑
Django超级用户
摘要:忘记密码from django.contrib.auth.models import User user =User.objects.get(username='admin') user.set_password('new_password')user.aave()创建超级用户 python man
阅读全文
posted @
2017-05-17 01:10
mljqqh
阅读(661)
推荐(0) 编辑
C语言的变量 常量
摘要:变量就是可以随时变化的 可以被赋值 常量是是固定的值 不能被赋值 生活中的常量 比如 π
阅读全文
posted @
2017-05-09 00:51
mljqqh
阅读(154)
推荐(0) 编辑
C语言的编译 链接
摘要:C语言的编译执行过程 :代码-》编译-》链接=》执行 编译指的是把代码编译编译成机器能识别的二进制 0 1 链接是就是经过编译的文件并不能立即就被执行,其中可能还有许多没有解决的问题。例如,某个源文件中的函数可能引用了另一个源文件中定义的某个符号(如变量或者函数调用等);在程序中可能调用了某个库文件
阅读全文
posted @
2017-05-09 00:49
mljqqh
阅读(141)
推荐(0) 编辑
1 hello word
摘要:#include <stdio.h> // 包含头文件stdio.h stdio 就是指 “standard input & output"(标准输入输出) h是head int main() //主函数{printf("Hello World!\n");//输出hello word 到黑窗口ret
阅读全文
posted @
2017-05-09 00:35
mljqqh
阅读(106)
推荐(0) 编辑
java 中 == 与 equals引出的字符串比较
摘要:==基本类型:比较的是值引用类型:比较的是地址 equals方法Object上帝类中比较的是对象的地址String 类对equals进行了重写(自己看看源码),比较的是字符串的值 有了这个做铺垫,然后就是字符串拼接原理: String字符串拼接符 “+”底层原理 剖析java的字符串拼接机制 举个栗
阅读全文
posted @
2017-05-08 00:13
mljqqh
阅读(135)
推荐(0) 编辑