写点什么

《Django 5 By Example》阅读笔记:p645-p650

作者:codists
  • 2024-11-18
    广东
  • 本文字数:1103 字

    阅读完需:约 4 分钟

《Django 5 By Example》学习第 8 天,p645-p650 总结,总计 6 页。

一、技术总结

1.django-rest-framework

(1)serializer

p648, Serializer: Provides serialization for normal Python class instances。Serializer 又细分为 Serializer, ModelSerializer, HyperlinkedModelSerializer.

2.目录结构

.courses
├── __init__.py
├── admin.py
├── api
│ ├── __init__.py
│ ├── serializer.py
│ └── views.py
├── apps.py
├── fields.py
├── fixtures
│ └── subjects.json
├── forms.py
├── migrations
│ ├── 0001_initial.py
│ ├── 0002_video_text_image_file_content.py
│ ├── 0003_alter_content_options_alter_module_options_and_more.py
│ ├── 0004_course_students.py
│ └── __init__.py
├── models.py
├── output.txt
├── static
│ └── css
├── templates
│ ├── base.html
│ ├── courses
│ └── registration
├── templatetags
│ ├── __init__.py
│ └── course.py
├── tests.py
├── urls.py
└── views.py
复制代码


引入 django-rest-framework 后,API 相关的代码放到 api 目录,如上所示。

二、英语总结(生词:2)

1.bookmark vs bookmarklet

(1)bookmark

c. a piece of thick paper, leather or plastic that you put betweent the pages of a book so that you can find a page again quickly(书签).

(2)bookmarklet

A bookmarklet is a bookmark stored in a web browser that contains JavaScript commands that add new features to the browser(书签工具).

2.negotiation

p650, The framework determines which renderer to use through content negotiation by inspecting the request’s Accept header to determine the expected content type for the response.

(1)negotiate

neg-("not") + otium("ease, leisure"). 字面意思是"lack of leisure(空闲)",后来演变为"have formal discussions with someone in order to reach an agreement with them(协商)"之意。

三、其它

书上的项目太多了,我自己则是比较关心 django-rest-framework 的使用,因为这是实际工作中用得最多的。鉴于此,作者在第 15 章引入 django-rest-framework,所以直接跳到第 15 张开始学习。

四、参考资料

1. 编程

(1) Antonio Melé,《Django 5 By Example》:https://book.douban.com/subject/37007362/

2. 英语

(1) Etymology Dictionary:https://www.etymonline.com


(2) Cambridge Dictionary:https://dictionary.cambridge.org


欢迎搜索及关注:编程人(a_codists)

发布于: 刚刚阅读数: 3
用户头像

codists

关注

公众号:编程人 2021-01-14 加入

Life is short, You need Python

评论

发布
暂无评论
《Django 5 By Example》阅读笔记:p645-p650_Python_codists_InfoQ写作社区