All Projects → liaogx → imooc

liaogx / imooc

Licence: Apache-2.0 license
由浅入深全面掌握Django ORM开发的知识,以Django官方文档为依据,内容完整、准确、权威。视频学习地址:

Programming Languages

python
139335 projects - #7 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to imooc

Intellij Platform Solarized
Solarized UI and editor themes for IntelliJ IDEA, CLion, Rider, PyCharm, RubyMine, PhpStorm, WebStorm, Android Studio, DataGrip and GoLand
Stars: ✭ 148 (+159.65%)
Mutual labels:  pycharm
pybind11-stubgen
Generates stubs for python modules (targeted to C++ extensions compiled with pybind11)
Stars: ✭ 103 (+80.7%)
Mutual labels:  pycharm
intellij-autohotkey
AutoHotkey plugin for the Jetbrain's IntelliJ platform
Stars: ✭ 30 (-47.37%)
Mutual labels:  pycharm
Intellij Csv Validator
CSV validator, highlighter and formatter plugin for JetBrains Intellij IDEA, PyCharm, WebStorm, ...
Stars: ✭ 198 (+247.37%)
Mutual labels:  pycharm
odoo pycharm autocomp
auto complete syntax for odoo openerp 8,9,10 ,11
Stars: ✭ 14 (-75.44%)
Mutual labels:  pycharm
birdseye-pycharm
IntelliJ IDE plugin for the Python debugger birdseye
Stars: ✭ 32 (-43.86%)
Mutual labels:  pycharm
Mypy boto3 builder
Type annotations builder for boto3 compatible with VSCode, PyCharm, Emacs, Sublime Text, pyright and mypy.
Stars: ✭ 123 (+115.79%)
Mutual labels:  pycharm
interstellar
Dark editor theme for JetBrains IDEs
Stars: ✭ 26 (-54.39%)
Mutual labels:  pycharm
Face-Recognition-Attendance-System
Face Detection | Recognition | Attendance
Stars: ✭ 289 (+407.02%)
Mutual labels:  pycharm
jetbrains-utility
Remove/Backup – settings & cli for macOS (OS X) – DataGrip, AppCode, CLion, Gogland, IntelliJ, PhpStorm, PyCharm, Rider, RubyMine, WebStorm
Stars: ✭ 62 (+8.77%)
Mutual labels:  pycharm
Live Py Plugin
Live coding in Python with PyCharm, Emacs, Sublime Text, or even a browser
Stars: ✭ 222 (+289.47%)
Mutual labels:  pycharm
Blender-PyCharm
Example setup for blender addon development in pycharm
Stars: ✭ 48 (-15.79%)
Mutual labels:  pycharm
airflow-boilerplate
A complete development environment setup for working with Airflow
Stars: ✭ 94 (+64.91%)
Mutual labels:  pycharm
Awesome Pycharm
A curated list of resources for learning and using PyCharm, a Python IDE from JetBrains
Stars: ✭ 174 (+205.26%)
Mutual labels:  pycharm
JetBrainsRunner
A Krunner Plugin which allows you to open your recent projects
Stars: ✭ 31 (-45.61%)
Mutual labels:  pycharm
Tabnine Intellij
Jetbrains IDEs client for TabNine. Compatible with all IntelliJ-based IDEs. https://plugins.jetbrains.com/plugin/12798-tabnine
Stars: ✭ 140 (+145.61%)
Mutual labels:  pycharm
KV4Jetbrains
Syntax highlighting and auto-completion for Kivy/KivyMD .kv files in PyCharm/Intellij IDEA
Stars: ✭ 93 (+63.16%)
Mutual labels:  pycharm
Invisible-Cloak-And-Magic-Wand-using-OpenCV
This is one of my OpenCV that is Computer Vision project named in vi . That is inspired from Harry potter Invisible Cloak
Stars: ✭ 16 (-71.93%)
Mutual labels:  pycharm
jetbrains-theme
🎨 A modern, productivity-increaser theme for all JetBrains IDEs
Stars: ✭ 108 (+89.47%)
Mutual labels:  pycharm
jvm-development-environment
A Vagrant controlled software development environment built around IntelliJ IDEA, PyCharm, Docker and Ubuntu.
Stars: ✭ 42 (-26.32%)
Mutual labels:  pycharm

开发环境

Windows/MacOS/Linux,搭建Django开发环境:

  • 前端:HTML/CSS + jQuery 3.3
  • Django 1.11
  • Python 3.6
  • MySQL 5.7

数据库操作:

# 创建数据库imooc
create database imooc charset utf8;
# 切换到imooc库
USE imooc;
/*root:所有权限,只能localhost连接*/
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;

效果演示

通过刷新前端,触发ORM操作

MySQL数据表(Django自带的数据表除外)

课程内容

中级课程。由浅入深全面掌握Django ORM开发的知识,以Django官方文档为依据,内容完整、准确、权威

第1章 课程介绍

1.1 课程内容与导学

介绍本课程的学习内容和目标,如何学习本课程,引导学生对Django ORM有一个基础且全面的了解,并能够在课程结束后独立使用Django完成ORM的开发。

第2章 ORM介绍

2.1 什么是ORM

Django ORM介绍,模型类的概念、由来、优势、劣势。

第3章 字段类型和参数

3.1 常用的字段

全面介绍Django ORM中所有的字段。

3.2 关系型字段

一对一(OneToOneField);多对一(ForeignKey);多对多(ManyToManyKey),默认中间表。

3.3 字段参数

详解所有字段都有的公共参数和个别字段的私有参数。

3.4 自关联

以”省-市-县-村“为例,如何在一张表中实现自关联存储。

第4章 元数据Meta

4.1 元数据介绍

讲解元数据的概念,举例常用的元数据。

第5章 Django数据表操作

5.1 Django更改数据表

介绍migrations文件夹,django_migrations表的含义;Django ORM如何创建与更改数据表。

5.2 Django数据导入

使用python manage.py shell/loaddata写入,使用脚本或creat()bulk_create()批量导入。

5.3 Django数据导出

通过 python manage.py dumpdata导出数据,或用数据库自带的导出命令。

第6章 Models API

6.1 查询集QuerySet介绍

查询集QuerySet介绍,如何创建、保存、检索、过滤;

字段数据正则匹配,大小写敏感;

结果切片,排序,链式查询;

如何查看与执行生SQL语句。

6.2 返回新QuerySet的API

Models API 使用说明
filter() 过滤查询对象
exclude() 排除满足条件的对象
annotate() 使用聚合计数,求和,平均数等
order_by() 对查询集进行排序
reverse() 反向排序
distinct() 对查询集去重
values() 返回包含对象具体值的字典的QuerySet
values_list() 与values()类似,只是返回的是元组而不是字典
dates() 根据日期获取查询集
datetimes() 根据时间获取查询集
none() 创建空的查询集
all() 获取所有的对象
union() 并集
intersection() 交集
difference() 差集
select_related() 附带查询外键关联的对象,优化一对一,多对一查询
prefetch_related() 预先查询外键关联的对象,优化一对多,多对多查询
extra() 实现别名,条件,排序等
defer() 排除不需要的字段
only() 仅选择需要的字段
using() 选择数据库
select_for_update() 锁住选择的对象,直到事务结束
raw() 接收一个原始的SQL查询

6.3 不返回QuerySet的API

Models API 使用说明
get() 获取单个对象
create() 创建对象,无需save()
get_or_create() 查询对象,如果没有找到就新建对象
update_or_create() 更新对象,如果没有找到就创建对象
bulk_create() 批量创建对象
count() 统计对象的个数
in_bulk() 根据主键值的列表,批量返回对象
iterator() 获取包含对象的迭代器
latest() 获取最近的对象
earliest() 获取最早的对象
first() 获取第一个对象
last() 获取最后一个对象
aggregate() 聚合操作
exists() 判断queryset中是否有对象
update() 批量更新对象
delete() 批量删除对象
as_manager() 获取管理器

6.4 自定义聚合查询

实现一个自定义的聚合查询功能,比如group_concat。

第7章 F对象与Q对象

7.1 F对象与Q对象的使用

如何使用F对象操作字段的数据,使用Q对象实现复杂的查询,结合AND, OR, NOT, |, ~, &操作。

第8章 课程总结

8.1 课程总结

在本课程中,我们通过开发4个具有关联关系的模型类(讲师、课程、学生、助教),把所有知识串联起来,全面的讲解了Models的开发知识。更高级的内容,如自定义字段、自定义管理器、自定义中间表和模型类的继承,欢迎关注后续课程。

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].