Category Archives: CODEX

设置hr横线的颜色

给默认的hr改成我们需要的颜色时,需要将它的高度设一个值,使用背景色,并将border设为没有。
如:<hr style=”background-color:black;height:1px;border:none;”>

samba start error

smbd: relocation error: /lib/libsamba-credentials.so.0: symbol GSS_KRB5_CRED_NO_CI_FLAGS_X, version gssapi_krb5_2_MIT not defined in file libgssapi_krb5.so.2 with link time reference
Package krb5-libs-1.13.2-11.fc23.i686 is already installed
should update krb5-libs-1.13.2 to krb5-libs-1.14.1
so: sudo dnf install krb5-libs-1.14.1-*
other words,  security should be set as share
or smbd would not start properly (error exit)
DONE

django:DateTimeField如何自动设置为当前时间并且能被修改

创建django的model时,有DateTimeField、DateField和TimeField三种类型可以用来创建日期字段,其值分别 对应着datetime()、date()、time()三中对象。这三个field有着相同的参数auto_now和auto_now_add,表面上 看起来很easy,但实际使用中很容易出错,下面是一些注意点。 Continue reading django:DateTimeField如何自动设置为当前时间并且能被修改

django admin You don't have permission to edit anything ?

1, 在urls.py 文件中加入一行 admin.autodiscover()
admin.autodiscover() 是什么作用呢?
查看源码 分析到作用是把 settings.INSTALLED_APPS这个节点中的配置动态的加入到程序中来。
2,在models.py文件中将数据表注册到admin里,
from django.contrib import admin

admin.site.register(modelname)