Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_44848235
Python-100-Days
提交
0c25a31f
P
Python-100-Days
项目概览
weixin_44848235
/
Python-100-Days
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Python-100-Days
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0c25a31f
编写于
8月 19, 2018
作者:
骆昊的技术专栏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改了Django部分的代码
上级
b1bbe89e
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
117 addition
and
17 deletion
+117
-17
Day41-55/code/oa/hrs/index.html
Day41-55/code/oa/hrs/index.html
+22
-0
Day41-55/code/oa/hrs/migrations/0004_auto_20180815_1345.py
Day41-55/code/oa/hrs/migrations/0004_auto_20180815_1345.py
+66
-0
Day41-55/code/oa/hrs/models.py
Day41-55/code/oa/hrs/models.py
+13
-12
Day41-55/code/oa/oa/settings.py
Day41-55/code/oa/oa/settings.py
+1
-1
Day41-55/code/oa/requirements.txt
Day41-55/code/oa/requirements.txt
+9
-0
Day41-55/code/shop/cart/models.py
Day41-55/code/shop/cart/models.py
+1
-1
Day41-55/code/shop/cart/views.py
Day41-55/code/shop/cart/views.py
+3
-1
Day41-55/code/shop/shop/settings.py
Day41-55/code/shop/shop/settings.py
+1
-1
Day41-55/code/shop/templates/cart.html
Day41-55/code/shop/templates/cart.html
+1
-1
未找到文件。
Day41-55/code/oa/hrs/index.html
0 → 100644
浏览文件 @
0c25a31f
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
Document
</title>
<style
type=
"text/css"
>
#container
{
width
:
960px
;
margin
:
0
auto
;
}
#container
iframe
{
opacity
:
0.5
;
}
</style>
</head>
<body>
<div
id=
"container"
>
<iframe
src=
"http://www.jd.com"
width=
"960"
height=
"800"
></iframe>
</div>
<textarea
rows=
"10"
cols=
"50"
></textarea>
</body>
</html>
\ No newline at end of file
Day41-55/code/oa/hrs/migrations/0004_auto_20180815_1345.py
0 → 100644
浏览文件 @
0c25a31f
# Generated by Django 2.0.7 on 2018-08-15 05:45
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'hrs'
,
'0003_auto_20180524_1646'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'dept'
,
name
=
'excellent'
,
),
migrations
.
AlterField
(
model_name
=
'dept'
,
name
=
'location'
,
field
=
models
.
CharField
(
db_column
=
'dloc'
,
max_length
=
10
,
verbose_name
=
'部门所在地'
),
),
migrations
.
AlterField
(
model_name
=
'dept'
,
name
=
'name'
,
field
=
models
.
CharField
(
db_column
=
'dname'
,
max_length
=
20
,
verbose_name
=
'部门名称'
),
),
migrations
.
AlterField
(
model_name
=
'dept'
,
name
=
'no'
,
field
=
models
.
IntegerField
(
db_column
=
'deptno'
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'部门编号'
),
),
migrations
.
AlterField
(
model_name
=
'emp'
,
name
=
'dept'
,
field
=
models
.
ForeignKey
(
db_column
=
'dno'
,
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
to
=
'hrs.Dept'
),
),
migrations
.
AlterField
(
model_name
=
'emp'
,
name
=
'job'
,
field
=
models
.
CharField
(
db_column
=
'job'
,
max_length
=
10
),
),
migrations
.
AlterField
(
model_name
=
'emp'
,
name
=
'mgr'
,
field
=
models
.
IntegerField
(
blank
=
True
,
null
=
True
),
),
migrations
.
AlterField
(
model_name
=
'emp'
,
name
=
'name'
,
field
=
models
.
CharField
(
db_column
=
'ename'
,
max_length
=
20
),
),
migrations
.
AlterField
(
model_name
=
'emp'
,
name
=
'no'
,
field
=
models
.
IntegerField
(
db_column
=
'empno'
,
primary_key
=
True
,
serialize
=
False
),
),
migrations
.
AlterModelTable
(
name
=
'dept'
,
table
=
'TbDept'
,
),
migrations
.
AlterModelTable
(
name
=
'emp'
,
table
=
'TbEmp'
,
),
]
Day41-55/code/oa/hrs/models.py
浏览文件 @
0c25a31f
...
...
@@ -8,27 +8,28 @@ from django.db import models
class
Dept
(
models
.
Model
):
no
=
models
.
IntegerField
(
primary_key
=
True
,
verbose_name
=
'部门编号'
)
name
=
models
.
CharField
(
max_length
=
20
,
verbose_name
=
'部门名称'
)
location
=
models
.
CharField
(
max_length
=
10
,
verbose_name
=
'部门所在地'
)
excellent
=
models
.
BooleanField
(
default
=
0
,
verbose_name
=
'是否优秀'
)
no
=
models
.
IntegerField
(
db_column
=
'deptno'
,
primary_key
=
True
,
verbose_name
=
'部门编号'
)
name
=
models
.
CharField
(
db_column
=
'dname'
,
max_length
=
20
,
verbose_name
=
'部门名称'
)
location
=
models
.
CharField
(
db_column
=
'dloc'
,
max_length
=
10
,
verbose_name
=
'部门所在地'
)
#
excellent = models.BooleanField(default=0, verbose_name='是否优秀')
def
__str__
(
self
):
return
self
.
name
class
Meta
:
db_table
=
'
tb_d
ept'
db_table
=
'
TbD
ept'
class
Emp
(
models
.
Model
):
no
=
models
.
IntegerField
(
primary_key
=
True
)
name
=
models
.
CharField
(
max_length
=
20
)
job
=
models
.
CharField
(
max_length
=
10
)
mgr
=
models
.
ForeignKey
(
'self'
,
null
=
True
,
blank
=
True
,
on_delete
=
models
.
SET_NULL
)
#
mgr = models.IntegerField(null=True, blank=True)
no
=
models
.
IntegerField
(
db_column
=
'empno'
,
primary_key
=
True
)
name
=
models
.
CharField
(
db_column
=
'ename'
,
max_length
=
20
)
job
=
models
.
CharField
(
db_column
=
'job'
,
max_length
=
10
)
#
mgr = models.ForeignKey('self', null=True, blank=True, on_delete=models.SET_NULL)
mgr
=
models
.
IntegerField
(
null
=
True
,
blank
=
True
)
sal
=
models
.
DecimalField
(
max_digits
=
7
,
decimal_places
=
2
)
comm
=
models
.
DecimalField
(
max_digits
=
7
,
decimal_places
=
2
,
null
=
True
,
blank
=
True
)
dept
=
models
.
ForeignKey
(
Dept
,
on_delete
=
models
.
PROTECT
)
dept
=
models
.
ForeignKey
(
Dept
,
db_column
=
'dno'
,
on_delete
=
models
.
PROTECT
)
class
Meta
:
db_table
=
'tb_emp'
db_table
=
'TbEmp'
Day41-55/code/oa/oa/settings.py
浏览文件 @
0c25a31f
...
...
@@ -78,7 +78,7 @@ WSGI_APPLICATION = 'oa.wsgi.application'
DATABASES
=
{
'default'
:
{
'ENGINE'
:
'django.db.backends.mysql'
,
'NAME'
:
'
oa
'
,
'NAME'
:
'
HRS
'
,
'HOST'
:
'localhost'
,
'PORT'
:
3306
,
'USER'
:
'root'
,
...
...
Day41-55/code/oa/requirements.txt
0 → 100644
浏览文件 @
0c25a31f
asn1crypto==0.24.0
cffi==1.11.5
cryptography==2.3
Django==2.0.7
idna==2.7
pycparser==2.18
PyMySQL==0.9.2
pytz==2018.5
six==1.11.0
Day41-55/code/shop/cart/models.py
浏览文件 @
0c25a31f
...
...
@@ -8,7 +8,7 @@ class Goods(models.Model):
name
=
models
.
CharField
(
max_length
=
50
,
db_column
=
'gname'
)
price
=
models
.
DecimalField
(
max_digits
=
10
,
decimal_places
=
2
,
db_column
=
'gprice'
)
image
=
models
.
CharField
(
max_length
=
255
,
db_column
=
'gimage'
)
class
Meta
:
db_table
=
'tb_goods'
...
...
Day41-55/code/shop/cart/views.py
浏览文件 @
0c25a31f
from
django.core
import
serializers
from
django.shortcuts
import
render
,
redirect
from
cart.models
import
Goods
...
...
@@ -25,6 +26,7 @@ class ShoppingCart(object):
def
__init__
(
self
):
self
.
items
=
{}
self
.
index
=
0
def
add_item
(
self
,
item
):
if
item
.
goods
.
id
in
self
.
items
:
...
...
@@ -71,5 +73,5 @@ def add_to_cart(request, id):
def
show_cart
(
request
):
cart
=
request
.
session
.
get
(
'cart'
,
None
)
cart
=
serializers
.
deserialize
(
request
.
session
.
get
(
'cart'
)
)
return
render
(
request
,
'cart.html'
,
{
'cart'
:
cart
})
Day41-55/code/shop/shop/settings.py
浏览文件 @
0c25a31f
...
...
@@ -105,7 +105,7 @@ AUTH_PASSWORD_VALIDATORS = [
},
]
SESSION_SERIALIZER
=
'django.contrib.sessions.serializers.PickleSerializer'
#
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
# Internationalization
# https://docs.djangoproject.com/en/2.0/topics/i18n/
...
...
Day41-55/code/shop/templates/cart.html
浏览文件 @
0c25a31f
...
...
@@ -32,7 +32,7 @@
<th>
商品总价
</th>
<th>
操作
</th>
</tr>
{% for item in cart
.cart_items
%}
{% for item in cart %}
<tr>
<td
class=
"name"
>
{{ item.goods.name }}
</td>
<td
class=
"price"
>
¥
{{ item.goods.price }}
</td>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录