Comments (3)
Hi,
lambda **kw: 1
是指创建一个lambda
方法,这个方法接受**kwargs
这种命名参数,返回值永远是1
,然后再把这个空方法赋值给u.save
这个属性。我这样做是因为authenticate
这个方法期望返回一个user
对象,然后调用user.save()
方法将这个用户存到数据库里,为了防止他将我虚拟出来的user
也存到数据库里,我覆盖了真正user
的save
方法,使它永远返回成功,但是实际上却什么都没做。
WechatUser._meta.get_field('password').null = True
主要是WeCron的用户都是通过微信认证,而不是通过用户名密码认证,所以Django默认提供的password
这个field就没有作用,但是Django的password
默认是必须要有的,否则它的validator
会通不过,这里通过将password
的nullable
设为True
告诉validator
,这个password
属性可以为空。
from wecron.
收到.谢谢您.
from wecron.
看了您的代码...惊喜不断...每个settings models views 里面都有收获
原来Django还可以这样写呀..真的感谢您能开源这个项目
from wecron.
Related Issues (16)
- hi HOT 2
- 大佬公众号什么时候恢复 HOT 6
- 您好,请问服务什么时候能恢复呢? HOT 8
- 对你的 todo_parser 类很干兴趣,赞一个 HOT 1
- 有考虑Web版本或插件版本吗? HOT 1
- 提问 HOT 1
- 能实现一下“每个月最后一个周五”或者“每隔4周的周四”这种定时吗? HOT 1
- 弄个docker镜像?
- OK HOT 1
- 你好,请问下 模版消息是使用哪个行业的? HOT 1
- 能加个每小时或者半小时提醒吗? 比如半小时动一动 HOT 6
- bug
- 程序执行报错 KeyError: u'wechatpy:jsapi_ticket' HOT 2
- 自建公众号使用的话,需要在公众平台模板消息新建模板,替换模板ID HOT 1
- IntegrityError: duplicate key value violates unique constraint "user_pkey" HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wecron.