minkolee / django2-by-example-zh Goto Github PK
View Code? Open in Web Editor NEWDjango 2 by example个人翻译和整理
Django 2 by example个人翻译和整理
django2-by-example-ZH/chapter07.html
Line 496 in 526b559
因为item['price'] 是字符串, item['quantity'] 是整数,做完乘法再强制转换成Decimal,就报错了,该行应该改为:
sum(Decimal(item['price']) * item['quantity'] for item in self.cart.values())
2.3 登录与登出视图中使用内置视图添加的 path 中的 login
和 logout
后少了 /
符号;
以及以下 path 也有这样的问题:
password_change
reset/<uidb64>/<token>
第一章 3设计博客应用的数据架构(data schema)Post模型中
publish = models.DateTimeField(default=timezone.now())
应该是publish = models.DateTimeField(default=timezone.now)
第四章 5.1使用Google第三方认证 中
AUTHENTICATION_BACKENDS = [
'social_core.backends.facebook.FacebookAppOAuth2',
]
应该是 'social_core.backends.google.GoogleOAuth2'
重定向网址少了个-
http://mysite.com:8000/socialauth/complete/google-oauth2/
==》
http://mysite.com:8000/social-auth/complete/google-oauth2/
django2-by-example-ZH/chapter07.html
Line 154 in 526b559
2.4
Cart add()
方法代码未缩进。
2.6.2
<a href="{% url 'cart:cart_detail' %}">{{ total_items }} items{{ total_items|pluralize }}
中 filter 前的 items
应为 item
。
2.1
为此先来修改orders应用中的admin.py韦健
中的 韦健
应为 文件
。exprot_to_csv
拼写错误,应为 export
。4.3
编辑orders应用的urls.py文件,为视图配置URL
处path('admin/order/<int:order_id</pdf/',views.admin_order_pdf,name='admin_order_pdf'), ]
中 url 错误。order_pdf
方法中 <a href="{}">View</a>
的 View
应为 PDF
。么么哒
你好,请问下: 如果我创立了一个app叫做abc,那么项目下urls.py注册app的urls该怎么写? 测试了很多次但没成功.
"""moneydavis URL Configuration
The urlpatterns
list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import include, path
此处该如何写?
urlpatterns = [
path('admin/', admin.site.urls),
此处该如何写?
]
{% include 'pagination.html' with page = posts %} 此處 page=posts不能有空格
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.