随笔分类 -  在线教育平台

摘要:在线演示: http://47.244.22.82 python3+django2.0的环境 需要安装的库pip install django-simple-captcha django-pure-pagination Ueditor安装注册到github中搜索djangoueditor,发现一个l 阅读全文
posted @ 2018-09-07 10:25 坚强的小蚂蚁 阅读(790) 评论(0) 推荐(0) 编辑
摘要:对应github地址:第16天 一. 首页配置 1. courses/models.py -->class Course增加字段,迁移数据库 2. 配置view users/views.py中增加 3. 配置url,将原来的静态页面index配置修改为如下 4. index.html页面内容填充 4 阅读全文
posted @ 2018-09-07 10:24 坚强的小蚂蚁 阅读(613) 评论(0) 推荐(0) 编辑
摘要:对应github地址:第15天 一. 我的课程 1. 继承usercenter-base页面 2. 编写url, view 3. usercenter-mycourse.html中填充课程信息 需要注意的是课程链接标签<a href="{% url 'course:course_detail' us 阅读全文
posted @ 2018-09-05 14:42 坚强的小蚂蚁 阅读(468) 评论(0) 推荐(0) 编辑
摘要:对应github地址:第14天 一. 全局搜索 1. 使用关键词搜索 courses/views.py/CourseListView新增代码,不用把search_keywords传到前端 同样在organization/views.py/OrgView,拷贝上面代码,做简单修改 organizati 阅读全文
posted @ 2018-09-04 13:40 坚强的小蚂蚁 阅读(1159) 评论(0) 推荐(0) 编辑
摘要:对应github地址:第13天 把teacher-list.html和teacher-detail.html拷贝过来 一. 授课讲师列表页 1. 修改html文件 把org-list.html的页面内容拷贝到teacher-list.html中,替换面包屑和conteng内容 2. 编写URL和VI 阅读全文
posted @ 2018-08-31 11:11 坚强的小蚂蚁 阅读(357) 评论(0) 推荐(0) 编辑
摘要:对应github地址:第12天 一. 课程评论 1. 创建URL, VIEW courses/views.py -> Course courses/urls.py中新加 2. 使用模板改写course-comments.html 有额外的css,所以需要用到{% block custom_css % 阅读全文
posted @ 2018-08-30 10:50 坚强的小蚂蚁 阅读(363) 评论(0) 推荐(0) 编辑
摘要:对应github地址:第11天 一. 课程详情页2 1. 课程详情页第2块中的课程介绍中,修改course-detail.html中代码,搜索课程详情,找到如下代码 将原先<div>标签中的内容删除,用{{ course.detail }}替换掉,对应网页内容如下 2. 网页course-detai 阅读全文
posted @ 2018-08-29 17:21 坚强的小蚂蚁 阅读(339) 评论(0) 推荐(0) 编辑
摘要:对应github地址:第10天 一. 课程列表页 1. 拷贝course-list.html到templates目录中 2. 编写url和view 在courses/views.py中新加 在mxonline/urls.py中加入 新建courses/urls.py 3. 修改course-list 阅读全文
posted @ 2018-08-27 17:07 坚强的小蚂蚁 阅读(360) 评论(0) 推荐(0) 编辑
摘要:对应github地址:第9天 一. 实现我要学习功能 里面的三个字段对应operation/models/UserAsk中的变量 1. 首先对表单进行后台验证,新建orgazaiton/form文件,然后在里面定义之前的表单验证类。 因为我们已经定义了UserAsk类,发现定义的表单验证类和User 阅读全文
posted @ 2018-08-24 17:34 坚强的小蚂蚁 阅读(350) 评论(0) 推荐(0) 编辑
摘要:对应github地址:列表分页和按条件筛选 一. 列表分页 1. pip install django-pure-pagination 2. settings.py中 install app中添加'pure_pagination', 设置参数 PAGE_RANGE_DISPLAYED:总共会显示多少 阅读全文
posted @ 2018-08-22 10:48 坚强的小蚂蚁 阅读(281) 评论(0) 推荐(0) 编辑
摘要:对应github地址:https://github.com/pshyms/django/tree/master/mxonline/7_day 一. 定制不同页面中样式相同,内容不同的模板标签, 1. 拷贝org-list.html到templates目录中,新建base.html后把org-list 阅读全文
posted @ 2018-08-21 13:49 坚强的小蚂蚁 阅读(268) 评论(0) 推荐(0) 编辑
摘要:对应github地址:密码重置 原理: 1. 一个需要输入用户邮箱和注册码的密码忘记页面 2. 点击提交后,用户邮箱收到一个邮件,包含重置密码的链接 3. 点击链接进入密码重置页面 所以我们需要2个html页面实现重置功能 一. 忘记密码页面 把forgetpasssword.html拷贝到temp 阅读全文
posted @ 2018-08-21 09:49 坚强的小蚂蚁 阅读(369) 评论(0) 推荐(0) 编辑
摘要:github对应地址:验证码好麻烦 一. 安装 配置 1. pip install django-simple-captcha 2. add captcha to the INSTALLED_APPS in settings.py 3. 在mxonline/urls.py中添加 path("capt 阅读全文
posted @ 2018-08-15 17:22 坚强的小蚂蚁 阅读(442) 评论(0) 推荐(0) 编辑
摘要:一. 基于类来定义view.py diango中使用基于类来定义views的功能,其实更加方便,因为这样可继承一些定义好的基类,来减少我们的代码量 1. 使用基于类的方法,来重新定义user/views.py中的my_login函数功能 1.1首先引入基类中的View类,from django.vi 阅读全文
posted @ 2018-08-15 17:02 坚强的小蚂蚁 阅读(342) 评论(0) 推荐(0) 编辑
摘要:对应github地址:首页和用户登陆1 一. 显示首页 1. 修改mxonline/setttings.py 在TEMPLATES代码块修改DIRS为 'DIRS': [os.path.join(BASE_DIR, 'templates')], 2. 修改mxonline/urls.py,添加一行首 阅读全文
posted @ 2018-08-15 16:55 坚强的小蚂蚁 阅读(636) 评论(0) 推荐(0) 编辑
摘要:对应github地址:xadmin的使用 第三天:xadmin的安装以及各应用模型的后台管理注册 一. 安装xamdin 1. 源码包下载地址 https://github.com/sshwsfc/xadmin/tree/django2 找到压缩包位置,直接pip install xadmin-dj 阅读全文
posted @ 2018-08-15 16:30 坚强的小蚂蚁 阅读(880) 评论(0) 推荐(0) 编辑
摘要:前言 环境说明:python3.5 + django2.0, 用的pycharm4.04专业版 课程视频地址 https://coding.imooc.com/learn/list/78.html Navicat for MySQL 安装软件和破解补丁: 链接:https://pan.baidu.c 阅读全文
posted @ 2018-08-15 16:18 坚强的小蚂蚁 阅读(673) 评论(0) 推荐(0) 编辑
摘要:对应github链接:https://github.com/pshyms/django/tree/master/liuyanban 第一天 1. 创建一个新项目后,新建一个应用程序 python manager.py startapp message 2. 在message同级目录下创建3个目录st 阅读全文
posted @ 2018-08-15 15:57 坚强的小蚂蚁 阅读(2515) 评论(0) 推荐(1) 编辑
摘要:一. 使用原生sql,了解即可 使用原生sql的目的:解决一些复杂的sql不能用ORM方式写出的问题 有三种方式如下 1. extra: 结果集修改器,一种提供额外查询参数的机制 2. raw:执行原始sql并返回模型实例 3. 直接执行自定义的SQL 前两种方式要依赖于model,第三种不依赖mo 阅读全文
posted @ 2018-06-29 14:58 坚强的小蚂蚁 阅读(172) 评论(0) 推荐(0) 编辑
摘要:有如下模型为例 class Publisher(models.Model): name = models.CharField(max_length=30) address = models.CharField(max_length=50) website = models.URLField() cl 阅读全文
posted @ 2018-06-29 14:55 坚强的小蚂蚁 阅读(1786) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示