分类: 工具与技术 作者:victor 发布时间:2013-03-21
1、不修改源代码,直接改Model属性的其中一个方法:
`from django.db.models.signals import class_prepared
def longerusername(sender, *args, **kwargs):
# you can't just do if sender == django.contrib.auth.models.User
# because you have to import the model
if sender.name 'User' and sender.model 'django.contrib.auth.models.User':
sender.meta.getfield('username').maxlength = 100
classprepared.connect(longerusername)
2、找数字:
function getGetOrdinal(n) {
var s=["th","st","nd","rd"],
v=n%100;
return n+(s[(v-20)%10]||s[v]||s[0]);
}
3、找文件并删除:
针对目录:
find . -type d -exec chmod 755 {} \;
针对文件:
find . -type f -exec chmod 644 {} \;
`
转载请注明并请加上原链接或本站链接:linux的一些技巧转载自Findnow阅后记网