# layui_blog **Repository Path**: change1220/layui_blog ## Basic Information - **Project Name**: layui_blog - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-16 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 模型设计 ## 文章字段(Article) 1.文章分类(Category) 属于一对多的关系,一个分类下有多个文章 2.文章标题 3.是否最新标识 4.发布时间 5.封面图 6.摘要 7.文章正文,支持富文本格式 8.发布人 ## 微语字段(Whisper) 1.发布时间 2.微语内容 3.点赞数 4.评论数 5.留言人头像 6.留言人昵称 ## 留言字段(Leacots) 1.发布时间 2.留言内容 3.留言人头像 4.留言人昵称 ## 相册字段(Album) 1.上传时间 2.相册描述 3.位置 4.相册摘要 ## 网站基本配置(WebConfig) 1.首页banner图 2.微信 3.手机 4.QQ # 第三方app配置说明 ## djangoueditor https://www.cnblogs.com/hzjdpawn/p/11749741.html 1. 将djangoueditor源码拷贝到项目根目录下 2. INSTALLED_APPS 中配置 'DjangoUeditor' 3. 配置相关的url: `url(r'^ueditor/',include('DjangoUeditor.urls')),` 4.在models中这样定义 from DjangoUeditor.models import UEditorField class Blog(models.Model): Name=models.CharField(max_length=100,blank=True) Content=UEditorField('内容',height=100,width=500,default='test',imagePath="uploadimg/",imageManagerPath="imglib",toolbars='mini',options={"elementPathEnabled":True},filePath='upload',blank=True) 说明: UEditorField继承自models.TextField,因此你可以直接将model里面定义的models.TextField直接改成UEditorField即可。 UEditorField提供了额外的参数: toolbars:配置你想显示的工具栏,取值为mini,normal,full,besttome, 代表小,一般,全部,涂伟忠贡献的一种样式。如果默认的工具栏不符合您的要求,您可以在settings里面配置自己的显示按钮。参见后面介绍。 imagePath:图片上传的路径,如"images/",实现上传到"{{MEDIA_ROOT}}/images"文件夹 filePath:附件上传的路径,如"files/",实现上传到"{{MEDIA_ROOT}}/files"文件夹 scrawlPath:涂鸦文件上传的路径,如"scrawls/",实现上传到"{{MEDIA_ROOT}}/scrawls"文件夹,如果不指定则默认=imagepath imageManagerPath:图片管理器显示的路径,如"imglib/",实现上传到"{{MEDIA_ROOT}}/imglib",如果不指定则默认=imagepath。 options:其他UEditor参数,字典类型。参见Ueditor的文档ueditor_config.js里面的说明。 css:编辑器textarea的CSS样式 width,height:编辑器的宽度和高度,以像素为单位。 5.在表单中使用 class TestUeditorModelForm(forms.ModelForm): class Meta: model=Blog *********************************** 如果不是用ModelForm,可以有两种方法使用: 1: 使用forms.UEditorField from DjangoUeditor.forms import UEditorField class TestUEditorForm(forms.Form): Description=UEditorField("描述",initial="abc",width=600,height=800) 2: widgets.UEditorWidget from DjangoUeditor.widgets import UEditorWidget class TestUEditorForm(forms.Form): Content=forms.CharField(label="内容",widget=UEditorWidget(width=800,height=500, imagePath='aa', filePath='bb',toolbars={})) widgets.UEditorWidget和forms.UEditorField的输入参数与上述models.UEditorField一样。 # fontawesome使用说明[fontawesome官网地址](https://fontawesome.dashgame.com/) 1.引入CDN,将以下代码粘贴到网页HTML代码的 部分`` 2.使用默认CSS - 复制整个 font-awesome文件夹到您的项目中。 - 在HTML的 中引用font-awesome.min.css。 计算天数间隔 from datetime import datetime, timedelta a1 = '2017-10-07 09:01:04' a2 = '2017-10-05 10:02:50' test1 = datetime.strptime(a1, "%Y-%m-%d %H:%M:%S") print(type(test1)) test2 = datetime.strptime(a2, "%Y-%m-%d %H:%M:%S") diff = test2 - test1 print(diff.days) now = str(datetime.now()).split('.')[0] print(now, type(now)) a3 = datetime.strptime(now, "%Y-%m-%d %H:%M:%S") print(a3, type(a3)) diff1 = (a3 - test2).days print(diff1)