GithubHelp home page GithubHelp logo

django-by-example-zh's Introduction

《Django By Example》中文翻译

原作者: Antonio Melé

翻译用途:

  • 学习和提升英文阅读能力
  • 掌握和提升Django技能

章节及翻译进度:

安装Django (完成 by 夜夜月月 2016年12月10日

  • 创建一个独立的Python环境
  • 使用pip安装Django

创建你的第一个项目 (完成 by 夜夜月月 2016年12月10日

  • 运行开发服务器
  • 项目设置
  • 项目和应用
  • 创建一个应用

设计blog数据框架 (完成 by 夜夜月月 2016年12月10日

  • 激活你的应用
  • 创建和进行数据迁移

为你的模型(models)创建一个管理站点 (完成 by 夜夜月月 2016年12月10日

  • 创建一个超级用户
  • Django管理站点
  • 添加你的模型到管理站点
  • 自定义模型(models)的展示形式

使用查询集和管理器(managers) (完成 by 夜夜月月 2016年12月10日

  • 创建对象
  • 更新对象
  • 取回对象
  • 删除对象
  • QuerySet什么时候会执行
  • 创建模型(model)管理器(managers)

构建列表和详情视图(views) (完成 by 夜夜月月 2016年12月10日

  • 创建列表和详情视图(views)
  • 为你的视图(vies)添加URL模式
  • 给模型(modes)的规范化URLs

为你的视图(views)创建模板(templates) (完成 by 夜夜月月 2016年12月10日

添加页码 (完成 by 夜夜月月 2016年12月10日

使用基于类的视图(views) (完成 by 夜夜月月 2016年12月10日

总结 (完成 by 夜夜月月 2016年12月10日

通过e-mail分享帖子 (完成 by 夜夜月月 2016年12月13日

  • 使用Django创建表单(forms)
  • 在视图(views)中操作表单(forms)
  • 使用Django发送e-mail
  • 在模板(templates)中渲染表单(forms)

创建一个评论(comment)系统 (完成 by 夜夜月月 2016年12月13日

  • 通过模板(models)创建表单(form)
  • 在视图(views)中操作ModelForms
  • 在帖子详情模板(template)中添加评论(comments)

添加标签(tagging)功能 (完成 by 夜夜月月 2016年12月13日

获取类似的帖子 (完成 by 夜夜月月 2016年12月13日

总结 (完成 by 夜夜月月 2016年12月13日

django-by-example-zh's People

Contributors

levelksk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-by-example-zh's Issues

第七章>创建目录模板(templates)| 代码错误

第七章

创建目录模板(templates) 下最后一个代码块中:

{% extends "shop/base.html" %}
{% load static %}

{% block title %}
    {% if category %}{{ category.title }}{% else %}Products{% endif %}
{% endblock %}

{% block content %}
    <div class="product-detail">
        ![]({% if product.image %}{{ product.image.url }}{% else %}{% static )
        <h1>{{ product.name }}</h1>
        <h2><a href="{{ product.category.get_absolute_url }}">{{ product.category }}</a></h2>
        <p class="price">${{ product.price }}</p>
            {{ product.description|linebreaks }}
    </div>
{% endblock %}

其中

![]({% if product.image %}{{ product.image.url }}{% else %}{% static )

应该是

<img src="{% if product.image %}{{ product.image.url }}{% else %}{% static "img/no_image.png" %}{% endif %}">

关于转载的问题

我可以转载到自己的网站吗?
署名,会贴上原地址。
就是自己看着方便

Official Errata on 2017-04-17

Errata

- 12 submitted: last submission 30 Mar 2017

Chapter 1,

Building a Blog Application | Section: Creating objects | Page no: 18 |Errata category: Code

The code given is:

>>> Post.objects.create(title='One more post',
                        slug='one-more-post',
                        body='Post body.',
                        author=user)

It should be as follows:

>>> post = Post(title='One more post',
                    slug='one-more-post',
                    body='Post body.',
                    author=user)

Chapter 2,

Enhancing Your Blog with Advanced Features | Section: Handling ModelForms in views | Page no:47 | Errata category: Technical

The sentence given is:

Edit the models.py file, add imports for the Comment model and the CommentForm form, and modify the post_detail view to make it look like the following:

It should be:

Edit the views.py file, add imports for the Comment model and the CommentForm form, and modify the post_detail view to make it look like the following:

Chapter 2,

Enhancing Your Blog with Advanced Features | Section: Adding comments to the post detail template | Page no: 49 | Errata category: Technical

The sentence given is:

Open the blog_detail.html template and append the following code inside the content block:

It should be:

Open the views_detail.html template and append the following code inside the content block:

Chapter 3:

Extending Your Blog Application | Section: Creating a search view | Page no: 83 | Errata category: Code

The code given is:

def post_search(request):
	form = SearchForm()

	if 'query' in request.GET:
		form = SearchForm(request.GET)

	if form.is_valid():

The code should be:

def post_search(request):
	cd = None
	form = SearchForm()

	if 'query' in request.GET:
		form = SearchForm(request.GET)

	if form.is_valid():

Chapter 3:

Extending Your Blog Application | Section: Creating feeds for your blog posts | Page no: 74 | Errata category: typo

The sentence given is:

Navigate to http://127.0.0.1:8000/blog/feed/ in your browser. You should now see the RSS feedincluding the last five blog posts:

It should be:

Navigate to http://127.0.0.1:8000/blog/feed/ in your browser. You should now see the RSS feed including the last five blog posts:

Errata Type: Technical | Page 49 |

\1. The sentence given is: Now we need to adapt our post_detail.html template to do the following:

It should be: Now we need to adapt our post/detail.html template to do the following:

\2. The sentence given is: Open the blog_detail.html template and append the following code inside the content block:

It should be: Open the post/detail.html template and append the following code inside the content block:

\3. Errata for this mistakes on page https://www.packtpub.com/books/content/support/20895 has mistake Open the views_detail.html template and append the following code inside the content block:

It should be: Open the post/detail.html template and append the following code inside the content block:

On page 364 | Chapter 10 | Under section "Using mixins from django-braces"

Make OwnerCourseMixin inherit LoginRequiredMixin like this:

class OwnerCourseMixin(OwnerMixin, LoginRequiredMixin) :

Should be:

Make OwnerCourseEditMixin inherit LoginRequiredMixin like this:

class OwnerCourseEditMixin(OwnerMixin, LoginRequiredMixin) :

Chapter 1:

Extending Your Blog Application | Section: Using the filter() method | Page no: 18 | Errata category: code

The code given is:

Post.objects.filter(publish__year=2015)\
                   filter(author__username='admin')

It should be:

Post.objects.filter(publish__year=2015)\
                  .filter(author__username='admin')

Chapter 3:

Extending Your Blog Application | Section: Creating a search view | Page no: 84 | Errata category: typo

The sentence given is:

If the form is valid, we use the we use SearchQuerySet to perform a search for It should indexed Post objects whose main content contains the given query.

It should be:

If the form is valid, we use the SearchQuerySet to perform a search for It should indexed Post objects whose main content contains the given query.

Chapter 4:

Building a Social Website | Section: Log in and log out views | Page no: 100 | Errata category: code

The code given is:

Hello {{ request.user.first_name }},

It should be:

Hello {{ request.user.username }},

Chapter 3:

Extending Your Blog Application | Section: Creating custom template tags | Page no: 64-65 | Errata category: Typo

Our template tag will accept an optional count parameter that defaults to 5 and allows us to specify the number of comments we want to display.

The template tag we just created can be used passing the optional number of comments to display like {% show_latest_posts 3 %}.

Now, edit the blog/base.html template and add the new template tag to display the last 3 comments.

The template tag is called passing the number of comments to display and the template is rendered in place with the given context.

They should be:

Our template tag will accept an optional count parameter that defaults to 5 and allows us to specify the number of posts we want to display.

The template tag we just created can be used passing the optional number of posts to display like {% show_latest_posts 3 %}.

Now, edit the blog/base.html template and add the new template tag to display the last 3 posts.

The template tag is called passing the number of posts to display and the template is rendered in place with the given context.

Errata Type: Typo | Chapter 2 | Page 40
This:

request.build_absolute_uri

Should be:

request.build_absolute_url

【Django By Example第一章翻译.md】中字符翻译错误问题

文章五分之四处,字符翻译错误, 原句为:
”只要你喜欢你可以连接许多模板标签(tempalte filters),每一个都会应用到上个输出生成的结果上。“

更正为:
”只要你喜欢你可以连接许多模板标签(template tag),每一个都会应用到上个输出生成的结果上。“

Typo from chapter2

In the code from email part, there is a line
request.build_absolute_url
However,build_absolute_uri() should be the correct API, as far as I'm concerned.

Same part
return render(request, 'blog/post/share.html', {'post': post, 'form': form, 'sent': sent})
only post,form,sent is rendered to template: share.html
but in share.html, "{{ post.title }}" was successfully sent to {{ cd.to }}. also involves cd

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.