django 模型

一、project 与app之间的关系

  1个project中可包含多个app

  eg:包含两个app的project的结构

  aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV8AAAFACAIAAACUV+iYAAAgAElEQVR4nO2d3VMbR97v819s5dK73kS7W7W368ggDDa4eAnGWJGz4cWUDTErJDA+TmoRRCKxgYBtzEbi1eQ5NmVrLMxIRpEoPFrX1tbxVi62astVe5F1El089dyc81+cixnN9Mz0SCNp9NKjL/W5kJp+m0H97V/3qL+809TSCgAAet6peQ8AAPUJ1AEAQMcCdXi1cVXD3ER/zS8MAFAmFVEHCAQANqBS6kCl5ldbQ5yuPt/cZI/rjImcIz5/X807XIE7UMvrssddNf8psgRJHZ4+fcrTfp48eVKwinLUwenyhQUhk8kIQmQ8d81iIplSVyh9jvjMlxqYW5n48Mrs1tb29vb29vbW3EjezHMDyt0YkUttb2/PDlf1npCt5++zuZugXFc5/dnaKqUeauv6Cp2ukdmS6q/EnddfqbN3cnmlSgIhqcPI1VGqOlwZKTzhm4kL8ucZj9SvFhj85XxhQTCvDs7huWV/XxPxyevxrywbT2XO3kkfoQJyKWfv5HLVP7hm+2xiUGmuq9gOmG+oqNbrRA7Mdyz/H8JClJXFw91djTTsPHxopgqoQ6HMfb6VFV/vmSbNOM/NAPoPgdPV5/OPEG/rQh3yz1pm+qa5LrMdUNdcujoYtM6cOlQtfFDU4WK/W6MOF/ovmamiZHVweiOZ3I+sDtS1Rn+Ik3OGvWfkPLmyXDQ8368uTlbrdM9HpTq5oNvgw60uGOU4pUu64prMYW/+IaH8jZWRVugT2eP/QhSUXKkteWWhxJy9k8tE8OmU3q4oBXsnl3MFNzcXFmilevwr6ppXlle2yFUMtc9kKbKHZCSsyaO5LvkqZue2tre3l/19ciXL/j7n8JxY2yfNVzQ1i92QS5FXKl47WbMmMifvalNLq9iKrvIto6swqpm8z1uKjqv+FrqPxIqvd2R2a2t2+EyPf5L6FySvlLyHVZMz1a7k6tqaLA3376+arKI0dXC6PEFODBm0uwyafQfirS8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XJZDKZTK6vr8svSHXg3vxfkcknL8lSTt0hSypO93wU6gBALVDU4WK/W6MOF/ovmamijNhBY9YiCBFfzrhNSdSE96SzmxLb50pdb54w6xlXvDrolxJiHtFFjnSsGyeuosnA1W5cd6XaVYzOw045b47zoKDyqHYlV9fWZGm4f3/VZBXlrSzIZbwnyAnhSEQ//Ii3Wmc3ve2KGc84fc16DE9qa7und5HT94fiaqcZ4eauFHEKqB4qdWhrP39wcMDz/PPnz9vaz5usIv+upJl9ByXRPR9VH4WmjkaVSSx9hi/sGWedOhTwm9K3bl53tM40OC0Oqoj2iWYwNM/z/BfBkPkqyt+VHA+Jc2O+2MHp9ZE+sdR6tEUsjR1ynTRQB50DrZn+5GmOeqXBkMdMzwGwBK06uFrPbm1vu1rPmq+ihF1J/RNNZVb0qlbscmb5qSfp7HaxeYLqxZLfM072lcvjLqvpIdlJTXNBTrunQHkOauhqp40U9DsshIedJ5jz6a/yM2DQmFT821BGsQMAoM6BOgAA6Px/AVK5iC3eM2UAAAAASUVORK5CYII=" alt="" />

  project:存放对各个app的配置

  app:真正的业务代码,包含models和views,以package的形式存在,

     容易完整移植到其他project,从而被多个project复用    

二、用python代码定义表结构

  1、python通过models实现create table的操作:

from django.db import models

class Book(models.Model):
name = models.CharField(max_length=50)
pub_date = models.DateField()

  2、python代码定义表结构的好处

    1)无需考虑不同数据库平台的兼容性问题,无论是mysql,mongodb,redis

       从python代码create table的方式都是一样的

    2)开发者专注于python代码,不用再去写sql,减轻大脑负担

    3)django框架中有特定的数据类型, eg:email类型,url类型

    4)性能考虑:不用每次系统启动或者发起请求都要先检查一下数据库结构,而是

        可以根据python代码就知道了目标数据库的结构。

  3、缺点

    每次修改了python数据库结构后,需要手动修改数据库中的表结构

 三、测试models在django中的使用

  1、基本准备

    1)创建django project和app

      aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAASYAAAEgCAIAAACW/0mQAAAdmUlEQVR4nO2dXVMbV4KG/QOS3dqrGW9tTa1nPLac7GS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PTEiESBttZ4oe1SHkKbe1tfXB7dveOq2V1d8+0TKWy20MTKbyZ8HIvsTz0oHk+6LCEQylU67ATHPp3rXLLJ4+i4lCTiGn3OLiR6fPnNVVufi3T8Lx3CL3Sr2cOxIlA4Jk2xFXKWkvxx+kgnKS6CEtx6OyO9kzjcWDWo4c2J9Dnlrf+vp6d8hINLKBt0+kHxLk/n5H8kZBQmHhgwQyKKGjZkR2wqh6BIMQ06ASKyQ6QvIgRbuLMeJxmsxHC4ohEeI+TTpqJSIhgjE+StDkj1VAySnq2yfGejkAKhkoB4CpYCYBAKYC5QAwlf8H2/x7GZAdSSwAAAAASUVORK5CYII=" alt="" />

    2)修改settings.py中的基本设置

      模板位置:

TEMPLATE_DIRS = (
os.path.join(BASE_DIR, 'templates'),
)

      数据库连接:

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'django_db',
'USER': 'root',
'PASSWORD': 'feng',
'HOST': '127.0.0.1',
'PORT': '',
}
}

      仅安装当前使用的app:

INSTALLED_APPS = (
# 'django.contrib.admin',
# 'django.contrib.auth',
# 'django.contrib.contenttypes',
# 'django.contrib.sessions',
# 'django.contrib.messages',
# 'django.contrib.staticfiles',
'model_test_app',
) MIDDLEWARE_CLASSES = (
# 'django.contrib.sessions.middleware.SessionMiddleware',
# 'django.middleware.common.CommonMiddleware',
# 'django.middleware.csrf.CsrfViewMiddleware',
# 'django.contrib.auth.middleware.AuthenticationMiddleware',
# 'django.contrib.messages.middleware.MessageMiddleware',
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

    执行ctrl+r+syndbc时,只会根据INSTALLED_APPS设置的app来检查

    对应的数据库表是否存在,其他没有设置的app不会被检查。

    3)此时数据库中的状态(之前有过其他project的测试数据)

     aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAO4AAADDCAIAAAAKvrqdAAAQJElEQVR4nO2dW3MTRxqG/fNUuUpVfkAqF8lFrjaJajcF2QTKhsgHGQtssI0cMNiBcAy7YJ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/g95j/+xy8o6QAAAAABJRU5ErkJggg==" alt="" />

   2、通过models.py定义表结构

     1)models.py中录入以下代码:

from django.db import models

class Publisher(models.Model):
name = models.CharField(max_length=30)
address = models.CharField(max_length=50)
city = models.CharField(max_length=60)
state_province = models.CharField(max_length=30)
country = models.CharField(max_length=50)
website = models.URLField() class Author(models.Model):
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=40)
email = models.EmailField() class Book(models.Model):
title = models.CharField(max_length=100)
authors = models.ManyToManyField(Author)
publisher = models.ForeignKey(Publisher)
publication_date = models.DateField()

    以上python定义表结构涉及到的知识点:

    a)字段类型:

        字符串类型,URL类型,Email类型,Date类型 

    b)多对多关系:

        authors = models.ManyToManyField(Author)

    c)外键:

        publisher = models.ForeignKey(Publisher)

    d)关于主键:

         无需显式指明主键,django会自动为每个模型生成一个自增的整数id作为主键

   2)通过python在数据库中创建表:

    a)检查model的语法和逻辑是否正确:ctrl+r+validate

      aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAW4AAACQCAIAAACnLxYFAAASxUlEQVR4nO2dW3PcthXH+XXKfUrTzKQzbpKV4tKp186lUawmjmAlrh3ZXslZt2aT1uooHcttYzFxHWVly5Jd01FW1UvfOsP9Bn1o+5Km02m+Sx9IgiBuBEHsRfL/N2c88hIEDg6Aw8ND7sJ79kenIRAIpKF4by32IBAIpKF4s6+eg0AgkIbiTVwDCARyBMSbPX0OAoFAGopnXvTmzZtXr3104o33Jq40BAKZNvHMi/b7/a2trVu//8Pbi1cmrjcEApkq8cyLPnz48Ouvv97d3b1z5861678++eb5iWsPgUCmRLzZ08RQdnd3Dw4O9vf3Hz9+3O/312/devf9rqb8/PrBMGfz2gJ7aObaTjLYmD+1YN46BAKZZqnhSnZ2dvb39/f39weDwZMnT7a3tz/77LNfXP+4M/e+tPzMqdXN/ursaTJzamVtkHDeBAKBHCXxup2F+fWDpL+xNkiGw2HSX505RaSyvb39NcNXX3318OHDL7744ubN9YXzy7Onz3Hl253Vzby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K2m9wkOX0DhSloy42ru4bN+hsxR4SE0vUsXw2x2ZuiPmjB+V1LZI03NelvxeQTZtNZAoiSOo/RpSPqXWMZwWXIjaO1K9P1N/xtlSWJlhtJC52qt1PO5ei2ox6iyvxqm+r0SvoDalXAW0T8M4h5hZO6TGdGIPZczkJCm0hw1YSKupKJHmrSc3lblUaibRaIrROODdMuSmR58ItnWlVT1tzyRFCGGhc5VWunnc/VaUI2Rvr+V0MBkkm+7Bsx3cMRhrny4k3fb6Fl6refwfhCGpDjKNa0/qicof+2I04rtDqeYr3jLhrauOVevc2XNeltxTdN3QwxtQh+CZI9DFC/vqJpuMVnDWj2q0ErRX+5FEu41kyY619dKnM/6taAbo8r3s/SQafgODgDgaQa/VwIAcACiEgCAAxCVAAAcgKgEAOAARCUAAAcgKgEAOOD/Btv+f45eIHMAAAAASUVORK5CYII=" alt="" />  

    b)生成建表的sql语句:ctrl+r+sql

"D:\DevPlatform\PyCharm 3.1.3\bin\runnerw.exe" C:\Python27\python.exe "D:\DevPlatform\PyCharm 3.1.3\helpers\pycharm\django_manage.py" sql model_test_app D:/ProgramData/python/model_test
BEGIN;
CREATE TABLE `model_test_app_publisher` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`name` varchar(30) NOT NULL,
`address` varchar(50) NOT NULL,
`city` varchar(60) NOT NULL,
`state_province` varchar(30) NOT NULL,
`country` varchar(50) NOT NULL,
`website` varchar(200) NOT NULL
)
;
CREATE TABLE `model_test_app_author` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`first_name` varchar(30) NOT NULL,
`last_name` varchar(40) NOT NULL,
`email` varchar(75) NOT NULL
)
;
CREATE TABLE `model_test_app_book_authors` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`book_id` integer NOT NULL,
`author_id` integer NOT NULL,
UNIQUE (`book_id`, `author_id`)
)
;
ALTER TABLE `model_test_app_book_authors` ADD CONSTRAINT `author_id_refs_id_206f10ad` FOREIGN KEY (`author_id`) REFERENCES `model_test_app_author` (`id`);
CREATE TABLE `model_test_app_book` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`title` varchar(100) NOT NULL,
`publisher_id` integer NOT NULL,
`publication_date` date NOT NULL
)
;
ALTER TABLE `model_test_app_book` ADD CONSTRAINT `publisher_id_refs_id_f51d29ce` FOREIGN KEY (`publisher_id`) REFERENCES `model_test_app_publisher` (`id`);
ALTER TABLE `model_test_app_book_authors` ADD CONSTRAINT `book_id_refs_id_6f49ea9b` FOREIGN KEY (`book_id`) REFERENCES `model_test_app_book` (`id`); COMMIT; Process finished with exit code 0

    此处多生成了一张表:model_test_app_book_authors,用于描述多对多关系

    c)同步sql语句到数据库: ctrl+r+syncdb

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZQAAAFYCAIAAAD7jZ04AAAgAElEQVR4nO2d7c7lxpHf53ZCfloE+WZgMTIWXCAjB1hEiBBop61dY3eBXUnJODCzSaRgFtB4E3toK/b4GXs8kmHa4xHmDnhuLh9INvulqvqFL4f9nP8PhKB5SHZXV3cXq4s8XQ+++73vj8eXX375X374z3/5V3+j/4IDBw4cpz0e6P+7u7t7+fLlj//1//znj//p6mLhwIEDh3w80P/3zTff/OlPf/r666+/+uqrH/7of/77//iDqwuHAwcOHNzx4LvfU+Px9ddfv3v37ttvv/39739/d3f37Mc//uu//USf9Y8Pn727zLz44WPz1Hs/fD28ff7h+4+F23HgwIFjzbEYr9evX3/77bfffvvt27dv//CHP7x69epnP/vZf/vR/3j0wd+Sd773/hcv7r747vfUe+9/9vTt4NgvHDhw4Nj1ePDe+2o8Xr169SeDP/7xj998880vf/nLL7989vgHn373e9/XV47Hw0dfvLj7Yvr/j5+/ePbZ9P9PXl8ul2E+9cndMHpn418+fPZuuHv+9O1gXmM6cW+efWb+5c1c7FiUvsUT5rOnb4c3b99dLpfxvy+ePI6s3bmGlGdslCOPeXz47N1w9/rFMJh1XS6XN8++ePp2GIZ3Tz9+TN6IAweOvGMxX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uzngRF5DOrb6YXI0b90pn7SrcKFvkWZmrGC9BZqHkVE2m+TjTWrZpu67rh06N305e03hFjo2acnZWypwtVepciO/fDKluN+ZFXCAZr1WeV/w7kabthaiWfJa95RrGi5M56Hlx0q41XpXqhk41bdc2Tdv3rSI/gDre8wqOjUp18quJ83hewT5Kmgu+VHjbmGy8aqo7hVhMPWq2Nc56n2joaIu/eDHHonw2huONV7BFQsmyrtx4EDWRBFQ39H03vrkb/8+/JtIQOD2Ybbzk9o7/7KbXC2xsO0PmsFT8eA7PBb6Pgu0VwHdemcbL6QP5xaXzum16RBhjqDPvdbrEC3AKZ2O4ivEKtEgI6Mq6snshNRqo56Rg9SRDYAwP9xVErvEKtdceSIwblSFzSCp5PIfnAtdHcnuDaOfrfrhddcZvG/2BFXwRWRtBnOC3LUnfxVRN26rlrFO1fFamsX/O6UhlNscRrGK+etO1C/fKMgdLlnXlVK2/1YrUiX5hN726Yz6m46qujXhzUosCUjHtdT7scj77WiNzulT+eJbngtRHwe8lZdRt/rYRAABOBfbzAgAUyf8HRpdRoYxh70YAAAAASUVORK5CYII=" alt="" />

    运行之后数据库中的情况:

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAO0AAAEGCAIAAAAG24UtAAAW2ElEQVR4nO2da3cTR57G9Z14N/sFdPJqzskHmGT2JC/yameis+EAO4MHTISNwQIMtpG5e0zA3HYDLANCSQjiGsxlMDeDFAtzGzaeJJCFdY5qX7TUXV23rpa6VdWt53fqgNWq/ndV99Olf6selzOEY2lp6cXLl0f/6/TWHfs2bJlYPzw+WBjff/DYk4WnS0tLfH0A4ubt27fbt29/8+bN69evf/zxpx9+WHz16n9evPjH/Qdzd+7cu3nz7xlmh2fPX4zv+qJ8/vLdB9WFZ6+ev/zh+csfnj5/defeoy9Pf71mYGS+vmCkJ6CXCafjpaWl3fsP15++nKsuzD74/vbd6q3Zx7dmH9++W529//3Dxwv1hZeDhR3v3r0LOGytmM0WazH2S+PoZtsAIiWcjn/99dfx3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o1EWfCCG1zynUPvpf+6qFZW5s6YDPM6hv84dv+x6FiCffXOQ4CI6QYrdCzcTt8t9EGpZsuwRcfwH8tG0CjXP+5Qx347cnCDO9cxd8Zk2KJj+I9V0Tr0H/NtazuvoOzIwQ0u+ddXlulYsbIyd8ZkmNcx/Mdefa5Euf6xP89RPdIJNzIPbXoNZl42O7vIXRfRcx6T1DlnTAb8x4kqwlsoofMybRUZ8B+3X6z1H0feti50P6k61gT+YxS6yLBdx+1h/HSjxFRkQMcoSSoybNdx2/7j8ncP8a9t/8anE9t13J7/2DlxKLaV+LBax/AfGyhhv9rTPhu9Ox637T+OYDxOn2+zcx3LFkHU7kJ8wH8MHWvruLMupHM8jtV/3ByPacct/MfyfdkpYlm1VmVfs/0nme019W5/Ksdj+I+t8B8LdSyr5mYXdC/8J7mf6fWM926ax+OY/Mf0eAz/sfBY/L7B1lD3X+L/sGJMmHSvq75o8WGLjuE/lo2gXfMf6+qY6YXCTOyP3xPjcbT+4+DxuLf9x759aYswo2NJXuHrhchM7PV6pmfGY/iPvfpcict/TFVTHYIxH9N5hehs8GbiykxvjMcx+Y9TO5/Xif/Ygu/44gP+4/ZLwvzHJcM6Tud4rEl7/uPUjscJL/Fhu47bw/gFQ+FLT4/H7WHcoIh/hf/GRzd0PDSy5w8rB/iSL0x0HhwA0h0dL+8b+nRVni/L+4Y6Dw4A6Y6O14k8xOs2FTFIg6joho7zw+PXbt7fOXnMKReu3n5QXdAepGvFbLZY816Xc5lssdb6DwBCOtexjo14YHPR0fHdufmdk8cmD5/64tjfhIP0g+pCH/fLHX4hQ79AQKc61rERb9gyMfP3hwePn1nVv0WYSyz/y7AzSD+oLqwZZE3xPiG7MqY31orZTCaTyThvlXOZXNm/X/Mnt16mWQOkhUAd/z+f4KjgTwK3eQAAAABJRU5ErkJggg==" alt="" />

    说明:1、实际上可以修改自动生成表名的规则

       2、重复执行ctrl+r+syndbc是安全的,不会生成重复的表也不会冲掉旧数据

       3、只会根据INSTALLED_APPS设置的app来检查对应的数据库表是否存在

   3、基本数据访问

      views.py

#coding:utf-8
from django.shortcuts import render
from django.shortcuts import render_to_response
from model_test_app.models import Publisher # Create your views here.
def db_op(request):
#删除
#Publisher.objects.filter(name='Apress').delete()
Publisher.objects.all().delete()
#新增
p1 = Publisher(name='Apress', address='2855 Telegraph Avenue',
city='Berkeley', state_province='CA', country='U.S.A.',
website='http://www.apress.com/')
p1.save()
p2 = Publisher.objects.create(name="O'Reilly",
address='10 Fawcett St.', city='Cambridge',
state_province='MA', country='U.S.A.',
website='http://www.oreilly.com/') #更新
pub=Publisher.objects.get(name='Apress')
pub.country='China'
pub.save()
#查询
publisher_list = Publisher.objects.all()
for publisher in publisher_list:
print publisher.name,publisher.country return render_to_response('db_op.html', locals())

    db_op.html:

<!DOCTYPE html>
<html>
<head>
<title>数据库操作</title>
</head>
<body>
<p>操作结果:</p>
<p>
<ul>
{% for publisher in publisher_list %}
<li>{{ publisher.name }}, {{publisher.country}}</li>
{% endfor %}
</ul>
</p>
</body>
</html>

      执行结果:

      页面:

     aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUIAAACECAIAAABqCbXWAAAZgUlEQVR4nO2dW28b17XH+S2c79GXxi8tkNgomiJJW9RGjUht5UAOirpuTgKcJn3IQ9PknBMcSHEiJW4cu7bUtKgdBMeWRSlOZIniZYakLrzqavki3uc+HFJSjJLnYe/Zc+HMcEhZlkZev4w4e9Zea+21yflzDy+hfW++9/mZ//zg7fc+jcyvBOJLgdhSIL4UiC/N6rbg3FJwbjk4txyaXwktrIQXV8OJVSq5TqfWo+mNWOZePHt/bvnB/PLD+ZWHC7ptfvnB/PKD+aX7c9l7cbRlNmKZjVh6I5reiKY26NRdOnmXSt6NJNbDi+vhxfXQwlpwYS04vzo7vzo7tzo7txKYWwnEVwLx5ZlYyxZf0bbYynRsZTq2rN/uRJfvoFvjNoU2enmKXsJbdPlbevnb6PJUdGUqtjIVW52Kr96ZW78zvz69sDGTuBdZyn0xFhgdm52Mrt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HcWfKvIvZZ/7Czyhk7bU2alJKe+7iqbBfKXLLPjTSv37V4Sp9b2yyzk3aMr4/n2HCfS6vxSfR/HW2cv0baW8qz4mJG/dnydz12GzCGuvPPxb/fGrKN30j76a/tJxdd52u+K0LzPHvmCSti+n1RVVNvqIg74espc786cdjMtpVAAAJsaPrhJgj3OAbhWQqP1TAvUdZjUq1P1WlIAANDAkgIAVA4sKQBA1fwfcVYKlcUoAz4AAAAASUVORK5CYII=" alt="" />

   4、模型中的__unicode__()方法:

     用于自定义输出“模型”的字符串内容,类似于java中的toString方法

     views.py中的输出操作:

def db_op(request):
#查询
publisher_list = Publisher.objects.all()
print publisher_list return render_to_response('db_op.html', locals())

    未添加__unicode__()方法时:

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAnkAAABCCAIAAACkSVexAAAODUlEQVR4nO2dO27rOhCG73qo3q3dCQjSOe4MKF0OchagrEI7cKVd2ECWkq2cW+g1fA1HFCnL8f/hFjdHEjkk58EhKfm/0+lUWChVNddrU6miKFTVXJtm/LMoClXW7bWtS1UUhVJl3V6vw5+Usm7burQLH0poKqWKoijrxn6WwfesqpprW5dq+HO4j/453qBU1QyFhGusGtrAuSVTgd3ldyU0lfvfF5TMMIyhomNt3zN3BPlR4OkkGfvB92xXAyPP+Ox4G9VY5/2cVEaLOn0fheTr7bvWUa9SZd3ql+xntZ7stbD7s6zb2+3mGx0AwNb4z3ehs/zbgBEJOlO/3W7Xa1uXVXO93m63Pjar/s/pWZdTq5r+ngh/YT+rqobWRWWY7iEtcork7YqyriutNwyZfSWPUvkeHOn8rqPqxSUzjWqbaqjCcPqRIygZhYBUWnvNCVwX55jeoI90KnptKruv+ptJJPMxttHZ1ZH1NtXYzLEVWsObitjXGJinqwViLQCPxn/OvJYypheqquJSKAAAAOCZ8ea1lG6Gbi9yAgAAACBIOK8FAAAAwBJEeS0AAAAAokFeCwAAAOQFeS0AAACQF+S1AAAAQF6Q1wIAAAB5QV4LAAAA5AV5LQAAAJA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WHcN2SYo8zZj7VyfsyTWyv3GCj7n2Ui/X2tjnk2VTZmTx9pgvc53OZbs1/re3Zz1umrWkpkq5Fd5nHF69VjreLFBzyDD1cXFWp/W2XoVjLXC01JOJ6i9i+WOtcSUopLa4q6xViLzBmNthM9Zsl8r9xsr+JxnI/05ZGPPv7BjrWzKnD7WsvUyL00uP4fsFFhO8pL5MQqOYKBk8+2ae8daKw9YNdZ6tC4i1q6W18YltcV9Y61A5q3F2mifs/wcMhEg5p0f/lngJPH7tb5PPUzvjYmnzGljLV+v7dyV2l1e6f7W0vdrbYHlpC2ZH6PgCIZLNsfIfe5mzfdrnb6Jj7XG5xKLqFjLa5213qPFSDsiztqvdawx0v1afxSPTmrtFjkl8f0jf5WPtUKZNxVrl/icJO/XFoi165Lhu1G6JdtnIIUOiz/lP3z9Rxxr2XrtnwQx7pd8pSW4jBN8+cQvXmTJ3nd+QmPEXA2XTG62U2RJi5LHWuPYqstz2ZpmChATa1mtM4Jrd/Bbk8r4c8Z0ygrb9o41Db16RUuOW98n1spk9m79CN6nmvVSjYSFPmf5d6MK1iPl82ZPS/rvIRfF9MqH8W5f0X9wxGMwugd0rphNBx0/z5dd/+rh90FNewnk+AA9r8jVa/x0oGcTYsb3n32RyX+DR7ClJTNvwTJjFLwaKJnu69inW0MtGm5L/BkTbZTpnMy3C2V+/YrrDR+M1tlSfR/6zqEfWiJvXkV8INr9bD+XmkzGOO0c2fP895D7qqO0jh5v9pwyC23l+rWOj7VCjZ3LQp8juRoQwOM38nkzsOrv1wY+oUBm7r7zqznqBRth+e/XborNah1zxmqzMjM8oszgCeHy2vWh3hZn2wDIwRa+/gjAs8HltQCAreFbfhSuB+i7MAi3AKzEtvJaAAAA4PfxP3jSqcYCFMYiAAAAAElFTkSuQmCC" alt="" />

    增加了__unicode__()方法时:

from django.db import models

class Publisher(models.Model):
name = models.CharField(max_length=30)
address = models.CharField(max_length=50)
city = models.CharField(max_length=60)
state_province = models.CharField(max_length=30)
country = models.CharField(max_length=50)
website = models.URLField() #def __unicode__(self):
#return self.name
def __unicode__(self):
return u'%s, %s'%(self.name,self.country)

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAlIAAAA+CAIAAABvFGIsAAAPBUlEQVR4nO2dO27rOhCG73ro3m3cCTDSJekMKF0OchagrEI7cOVdJECWkq2cW0ii+BgOhw/ZcvR/uMU9lkQOHzM/X1L+2wEAAACb4b9bGwAAAABcD8geAACADQHZAwAAsCEgewAAADYEZA8AAMCGgOwBAADYEJA9AAAAGwKyBwAAYENA9gAAAGwIyB4AAIANYcmeUm3/+fk18dm3tzILAACWoOkuX19fl665tSFgEdrekLDPvlXKv8eTvUvXUPcBAMAvQLX919fXJwLdb0epprtUlT3V9rXmgm13m/53q3yBnJu0Udt/9u2VMoUf3YSK1Q6uj9BDK8ue2WmGFQMH4QLC8Cwz7DIXXUNpKtV0l8/QZDZk/5qHe0Opt+OWugsNjdi27U7cRhmtL+E6ygc/Wo6hOKGVrlD7DiVySPXEUE3yrSBpo+ro9UDdiLoGhDaYNTY80jQJxmfHOomH1pS9prs4Vqq2N9t4bHVZSVTbS9ym6S4V3VWe701QTddfLqs1ry5jrx9cbvABwwNvJXuDYYtGH/jRcjhVN/5j7GNDxQcNnq4r459pcTlak0wrRK9Wh+iHTdfJxnxO64/Dr6S6Koh1UQ+tJntkkzjuuhv7yqVrZIulZe6axzrddaDp+q4Z7bu1LctixqMBs6fevI2WC0Dwo0WZqm22aqhaybOO7JGplZv3C2RPKSJGpZ4OKYx1fF3Vkb2QuhLuStUIbdkvdddxwJc5iunb2Jj0FxCazai2Hwq+hpDqB4Vy4EcJ6af7kZoGC9aPXt2yOUL2hLJXuspSHusYD60ge8xaKjNKdXYdxlUsw5Mnt4msa9Oj49hT5g3jrpFKyHde+LYNNjcMdBaOY2TLnlJt37c7rznnmmy6i2ez0CqyRNG6il7NY1K98HIT20ZM6xt7TvMGD3lPqDZcM+opH/xIP7iQH5H9KtrZ7DvdRU7nwZAfCffnUmVP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nBoUDyeqyF82XPJhesrcXeics9WWX5VL2s6APgMiOF2VYFdg5ry57xClte9Aazy5P9kK9zu9XUdkTHnIhY5kpbAHZMxe6c6Z6u5vKnsTmFcpeRswp2duTe6iwvEuv/V6HCic5na3anS97soFkfdlj82Vexio/yUkaLKd6ykwbkaXLO1XrWxXtG9ODy57kvKrsBXpdhuxdbbaXN9Xb3Vb2BDavTfayY075SU7DgITZntB/747S9/ZCb3PP76OIB5J1ZY/P14+zSu3Pj+ZeSOl7e77BcuqmHG0jf8FEGHB5q6L52r/XfHeFDBO87DnfCdtlyR7f67xVEEuufHFK2tsjFsHMvb2woGZP9fwSkZaEfuSv8rIntHlVslcSc6q8t7dLlD25/94dNb7SYjuVf4pMWE38keXpWxti2WPz9T/W7twv+SZCdJ0hepI+bF5mysEXGPg2Grb3jDdSfKfi39sLWcXnO99WW/acDUsqiPg9zTUgR/bYXufo3HBAzrLK+WfCyMZTUH9301RBO6OSA6u3kT2ZzcG9CcFZ5aQ3BCQUxpzyr7Ts2IhEllfov3dHhW9y7nRM9N4Z2o2fBgj0XTsYkTOM+ajY++m8H19p+j6oec3a2PU1T3xx+Tp/Xymw2J3wDVJq6vBjZiE8c1WcMvd2XbiN3KxTBDVqFZ+vkXtld7Ja2RwehXY7zJGcwGYSptf5Vn0fxjo3P2tiHBbP+Egp/ewYvGaXcRaiM2ue/ybnmDXf6wJXzQOigcNBsW2/sB/xsifxwQwKY47kasSAgIdGy5vtC2tm2b+3x7/t6B+jr/WR09/6luUvo/zv7a2K1fY65mjMam1muEebwaq48V9XNwPfL/iwNwArZA2fPQNgPdxY9gAAPKH1MeEs2d4mgPIBANkDAACwJSB7AAAANsT/RAN3QJPzGQ0AAAAASUVORK5CYII=" alt="" />

  5、关于update操作中的p.save()

    并不是只更新修改过的那个字段,所有的字段都会被更新

   6、django中实现where条件

    1)查询中对字段进行过滤

def db_op(request):
#查询
publisher_list = Publisher.objects.filter(name='Apress',country='China') print publisher_list return render_to_response('db_op.html', locals())

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OuBxBFh8jttOtC4eIr0YyurWsNfSNGSCuHAOfP9BXKUE9sNU81LeAEYRFleCJFoN+lazeWFUpJX9Rc878DEOyvnFxIFRvMLYfYUb07tb4Fn4fYxlKx2L9++PZfPL4QARpBy065W4IVou+j+05L8ArU3PvdBg8T1mXhaulazeaGQ5BV4AdkuvRF5Rwp5vEBZXWhXUV5IzESidOyufIIXnKWkduX3I0AOrwp5IcFZqNbgBbZdZlN6+X4EqnA6UMnRcU5E8fzCcslr70fclRcIq8vghbv5C+pwLPz8AvXYz7Txm+YsVKV5gW83NESldpdXNx5b+vxCqHA68AiFHed0bJ4XKoLZeV4AjyRXWbzAW13gR3vrOVy9s/ILSOTr5hdoxjE6r/C8o99qmAtNHFyEFxxvZ3xqLZkX2HbDV9zA+Ux/w3PIHsU2zGj1EMn8ODst5mvF9Gg9ydUKvDDsatuFgaRsQ0uDCuTwAmt1gAjM1pKnFfgzPa8cUkyYYXFpwm/o+3VX/v2IyhoN9sLs+UTON5gt1Gsadl+Hbblha/d2UFNk+3U8K+W+7GAmhmsXvE5OhMQz3geh1ufMl4ijkplx9k7g13YgfEaPVpBcrcALFZhl9/5B5UTcW11snCkwVhdqdTsMgzM8bX043rx96IwXRvBrhzvKtGTArsfxrNRdv7/AP4rjMiIaI63UruBJsPz7C0+Fp7U6Jn9pdX6u7zW5llGKFAQCgYuUfQ35vqNA8JtAhb2JfpYfiZNnPpe/IBAIngHiLwgEAgjxFwQCAQTiL1yv1+v1+hBtBALBMwDxF4QXBIJ/HP8DihDI9A3IDnUAAAAASUVORK5CYII=" alt="" />

    2)like关键词在django中的实现

def db_op(request):
#查询
publisher_list = Publisher.objects.filter(name__contains='eil') #publisher_list = Publisher.objects.all()
print publisher_list return render_to_response('db_op.html', locals())

    相当于:where name like '%eil%'

    执行结果:

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUYAAAA2CAIAAAA04KfSAAAKFUlEQVR4nO1dO47rOgx966F7t0lnIEiXSRfA081gZgHOK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WJt6TveaM+0Jpl6LmagtCvd3PpD9Q7TS8V0FQJhdf6onvtuubtrp/vT0zpoTChPoufSWb+Xpm9H+Ecpo2pIyXIFL4Lp30u/FF7B6tb/V03MRc3FZ4Hgn8X6lBYIBDRC+Qsa3QilBYJN4X+ASwQkzii/9AAAAABJRU5ErkJggg==" alt="" />

    3)get方法获取单条记录:

       a)恰好返回1条记录时

def db_op(request):

    try:
pub=Publisher.objects.get(name__contains='eil')
except:
print '获取单条记录发生异常'
else:
print pub.name return render_to_response('db_op.html', locals())

      aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUoAAABOCAIAAADJrcjwAAAMbklEQVR4nO1dQXLrIAz958H7bJOdZzrdpdllhu76p/8Azim4QVa+hTuTo/Qq/QtsDEIIjHGaUr35i9/ElgToISQc86dhMBiV4s/pdPpuG4pBdl0rxHdb8dvBo/A4+BP6QgiphuHj4+Pj42PoFw+YEG3XD8Og5F1GWkiVZycjhIwRLDIKbdePXjcoKYSU0hjz4UHr0nrhV0raVmkoucwwqRClfdf6kmm96O3jZUKqYTB3oZ1gRA1D37ULmoBHb6Cy7fqlRKWdQ4i2U5lOELpXSMX0Loi8EVw5CqPbCdEYJ9QEbrt+Eqs1TBdMF7ddb5lqbLf+XEaMUIu05JnhtF6pQAdOhsyfiLZTPfwQ17u8Y/HoLdXgiJ66Z5FoAkJIlesEoXuZ3vfEFqPgRxEh2q4fw5cJvIbeTdMI2WnSApo1LpEK0lsb4E4cYb0evZum0fOi++eoI6Q3Oxwi0VvPmoDMGQGcAJg+itzL9L4nio/CuFhw16haIFhR2/SeL7svvUPRG+p16e23pWkaqZScpIT06qk0w3gkek/9LLwP+64VOiuw5hWphsFOCeyk3R8GP4NK9wb63qk7KO0mlVqaw9iNGjNCAX3Ol2ylTEoKYYSAjNF4gBYCbMuQnNKQoe/aSYiSY2YLpGWMYMoo4IZhXocihd5AWsnFOWAsrde9WC9FHOFCKiX1V2BqM3r9u9KBRe9pZnY+tOyGDZ7+Bn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9WP3P9zRoQA69Sa8DfNbbDY5V4M8F8+woufwz540Ze+yXfZdTcNhAp6Pz+rj7Pe64jFuCt4OYM8b340UI+wFy3b+UXvC710CqueAZeywUfL4v/rVjVLJzwbKHT9baTEwcxOin2NxsQO8GjLIdBkK1BjtikS0iQHidb9XtMPbM+Ojr4XhzthgzHsKP7nsX/b03/cSLv4mSV8tZqpfxIFj/e++HwiN43WO9rcUe4FLcZjB+LfhdawzGT0Iol0RXPf8BSyDv4qjVHFUAAAAASUVORK5CYII=" alt="" />

       b)返回两条记录时

def db_op(request):

    try:
pub=Publisher.objects.get(name__contains='e')
except:
print '获取单条记录发生异常'
else:
print pub.name return render_to_response('db_op.html', locals())

      aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUYAAABPCAIAAAAYzfvbAAAQeElEQVR4nO1dPW7jPBN+z0P1buNOQJDOcReA6XaRPYB8Ct7AlW7hADlKrrJfQZEaDmeGpCQnWX3zYIuNJQ1/H84PqdF/5/O5UygUe8F/310BhUKxJf5TLa1Q7AmqpRWKXWFXWtoOQ2/Md9fi/x06Ct8LVksbY93t9v7+/v7+fhubB8mYfhhvt5uzXzK6xrpl9VRwWDCCm4xCP4zTrLs5a4y1NlbmPYMvy5eLLzkLa+XhbFvFrCMKHYc+lyyXSz4+3Wasu93iU2QnRFG32zj0hSbQWhoV0w9jKznlCWFMP7iFA889a6xTSm+IZSO4chSmaWdMFyehJ20/jEGsLyHcEG7uhxFUNdYd/FkmAwnUIi95ZrVcrnWoA0NF5l9MP7gR/0iXW9extJa27paIC11SFFcJY6xbOvDcs0rpr8Q9RiHXHMb0wzipqahgI6W7rjN28ERF1OpS8mxIaV+BdLHgy80o3XWdXwvTP6cyuHKbVCChpf3qiAi8QFELQEvGJs8qpb8Sm4/CZBSk9qcXiKxlSOn5tq+lNKelcbkppfO2dF1nnbNBCleuXz4rK0xo6dC3JvtxHHrjrXywflh3u0ETHzrhedfnHlH9DJCfDV0glR5doxqfJGk+EDt5eAbPs1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U020GV5ebBzDWURmO5OaXRj3kQaLHkTSgdpUlbmNTVu2rpRCd7h+jOvnSlwKIvXTm+2/vSOXCcs0JVdnegdLFccnNijS/N7XkKNieJSuItCCgu9qXrIesW8uodKJ2spJQ+LBe3jNLcrMv7uUjpyoDZ9hFvFGrqckpXqOjuHpQWyxU2G9dHvMkK14MjHrGCrKZ0V91eEjn5IWnlq3ND7hzx/lJKM7NuAaXvpaW7bNmDXhx3EmPe0KtT0d3WlJbLzeeQMYfrU3BTt9iXzitcD3YTizkgsVLy4n1p4mwJoJN8NZOz5f4luUjJlEZnM7tFlJZnXWa9Jm5ITul7+dKzdO40VVoVvBV5PFX2C0FpEMQOZ4CqKS2Wm78cg+6vOU1VtE6Luyl89QjJkzsN9g5z4hW3mrg6F9vLSUajhncHxaugaRtTGoUeqAhuPtNwBZZQWpx1iMN+kyipFfqzbvJsf8a76+ZdivwtucuZHSrU0aTOmXanp72xacvu42hmr/XtdDEGHtj2fSqVi94hZdzdhjPt1JL/+db85mBRcnIDeQyLI15FneUz3sJikUQQSM6XTkpvTukOjTJc+rl4Bz7lRs9nGcKsy2v1cZwGZTJqjqePZDO4ttwvfV9aPoUC1yE5UrptuYofgvXvS/8ofNes+x9LZLCtyHXcGwAAAABJRU5ErkJggg==" alt="" />

      c)没有记录返回时

def db_op(request):

    try:
pub=Publisher.objects.get(name__contains='eeeeeee')
except:
print '获取单条记录发生异常'
else:
print pub.name return render_to_response('db_op.html', locals())

      aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUoAAABVCAIAAACgvDqoAAAQi0lEQVR4nO1dO3LjuhK96wFzpVbGKpcz2Zmr4GymPAugVoEdOOIu5CovxVuZF4AAgf4RAClZw9enbnCtIdH49EF/AAL/dQqFYqf476croFAorgWlt0KxWyi9FYrdQumtUOwWe6C3HYbemJ+uxf87dBTuEJDexlh3uXx+fn5+fl7G6gEzph/Gy+Xi7E1G2ljXVk8Fh4YR3GQU+mGctO7irDHW2liZTwQvy8uF/+R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dQeisUu4XSW6HYLf4HhCM/1yhufFAAAAAASUVORK5CYII=" alt="" />

     4)排序   

def db_op(request):
#升序
publisher_list=Publisher.objects.order_by("name","country")
print publisher_list
#降序
publisher_list2=Publisher.objects.order_by("-name","country")
print publisher_list2 return render_to_response('db_op.html', locals())

      执行结果:

      aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAlUAAABUCAIAAAAkp1VpAAAViUlEQVR4nO1dO3LkOAzd81B5p3amKpcz25mr5Gy2Zg8gn0I3cNS3sKt8lLnKbECK4gcAwV+32sKrCcatDwGQwANBSvpnEAgEAoHgePjn2gIIBAKBQHAFCP8JBAKB4IgQ/hMIBALBESH8JxAIBIIjQvhPIBAIBEeE8J9AIBAIjgjhP4FAIBAcESj/KTUtn59fKz6X6ZJiCQQCQW+M8/nr6+s8j9cWRNAF0+JQ2OcyKRWcQPLfeR6jCwQCgeBnQE3L19fXpwS6nw6lxvnch//UtLSaHU7zdQbitdoV8HGVPpqWz2W6UKPiR1dBQ7MLLg+mh/biP3f06GJCAGZtQV9LJGJuPRa7p1LjfP4E57mE/HtOALXWx/FPO4R0J07TNLD7qKD3ObgMBYof9YNWByuCYf2rNQqQ64mYJele4PRRc9hSoe1EawGmDK7F9CXjmCF8cazjeGgX/hvncyCumha3s03381RS08Lxn3E+N/RbfrtXgRrn5XzerXhtYYa/9j3tDI4rXov/tGBdw5D4UT8EpjN/mDGmDY8KvB5Xzp95ATppSaIXkkebAxiH4zzzkr+g900elmWriliX9ND2/Af2TeC3gxk053nk1VHr/LYM+/RbjXFe5tHId21Z+sINTBrukL16H/WLROJHXbGabZNKm5ZzbcB/4N3qxfsB/KcUEKNyd5BUxjraVo35D+NbwG8h08At/lC/NSlgYV6zTKks9QcAm9+oadGK7yG2xtGhHuJHGffP9yO1Zg3ej5FtyRaF/5j8V1t3qY91hIe25D+i3krkrcHKhClwOS69+k+i9g3ny6mr3BPMypLKaHcrjvsCu4sKtonAQ4r5T6lpWaYh6tfNkuN8jmRm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HXUAAAAASUVORK5CYII=" alt="" />

      模型中指定默认排序规则:

class Publisher(models.Model):
name = models.CharField(max_length=30)
address = models.CharField(max_length=50)
city = models.CharField(max_length=60)
state_province = models.CharField(max_length=30)
country = models.CharField(max_length=50)
website = models.URLField() def __unicode__(self):
return u'%s, %s'%(self.name,self.country) class Meta:
ordering = ['-name']
def db_op(request):

    publisher_list=Publisher.objects.all()
print publisher_list return render_to_response('db_op.html', locals())

    执行结果:

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAlMAAAA8CAIAAADNHqgZAAAPEUlEQVR4nO2dO27jSBCG9zzNXKmVCTCc2c4M0NkMZg9An4I3UKRb2ICP4qvMBnz1o6q6+kGJWv4fNtgRyX5W1d8v0v80AAAAwJ7459YFAAAAAK4KlA8AAMC+gPIBAADYF1A+AAAA+wLKBwAAYF9A+QAAAOwLKB8AAIB9QSufMW3/+fk18dm3Vy4WEDh1l6+vr0t3unVBAABgo7S9JWGffWuMfZVXvkt3cm8FG8G0/dfX1yc6CAAAYhhz6i61lc+0fa0ZYdvdJpTfKt8SKjY7uD5t/9m3VzI5eCi4AjfpI6Uf1Vc+26mGJTgP5Yrc8KwwibFXX7k0jTl1l89wViuXf7OTp6E63FSd6/KhRh6pgY9rSbkXNH1UnXlBY+7EuQWUZbBbbHjkdEoo/FDrDGm5jvjBQ1clu/fvlNmEhk5s27ZR91FG72vQ+FFl5Tt1F6/LTdvbFRurqjML0/Ya+z51l4p+pc/3ynhNN/5jiOxmaHi2wNN1Y/0zzTmjLSn0QvRqdQg7PHWdTlS83h/je1Jbnbr+cskzoSHz1Kf0wEPXpqT3745R5Mco1Pafn/Zw81bK1yj8qKbykfbt+VUzht1Ld9Ktmpb5VR7b9Kup2ZZSDU2redZTPjK18uL9D5TPTH3v/5jSVqeu705EOurH12oreOgVKOz9O8IefA/YcnLzPpKtrprycRpL+BUVXOgc/6d+NQ50UrIwUzRyfgzaVswRyqdUvtIRaNv3bWwWLhOWvxx4aEL66R46U977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B+YNdA+QAAAOwLKB8AAIB9AeUDAACwL/4DbU1CHoxpCO8AAAAASUVORK5CYII=" alt="" />

      5)where和order by同时使用

def db_op(request):

    publisher_list=Publisher.objects.filter(name="Apress").order_by("name")
print publisher_list return render_to_response('db_op.html', locals())

     aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAATUAAAAlCAIAAACs3Ol8AAAEpUlEQVR4nO2cy5XcIBBFJx608vFxDEQwa8IgC5IgC3VyXoAQFFDQtNqqab97ZuPRh4Li8fho/PXr95/w8/39vQEAJPGV9Hl3JAAAyhf8EwCxwD8BkAv8EwC5wD8BkAv8EwC5wD8BkAv8EwC5wD8BkAv8EwC5wD8BkMuUfypl3L4/DnZn/mWIAMjHuEwguzNKXfLaKf9Uyjhv9UVFAvDBKKWtf4M+B/45p09l3FXuauw9I8Jd5YJ5bsmRcbszExJ4kz7ZIqf0mYtTW/+o8FbPxBSe3fsl5vPt3juV0tbvT800lHF8ufcSav3/LC5SFwpJNMZs0zlayP4MMxIV6p/aetJ1lHF5A8Umm+teyrgZnWjrL9TnfLm3oLR13osN71riUKTUlgamo+IzOXqTPkNgvM1I9M+mTog+t21T2ob+NQzrdX2uIVmf2jqrY3x3x/Je4kCe95ys09+eI77XifPP3ojS0Kea7V6fqs84rC8VYZwzKkxTPlmfvXmWMi5U/HZ9bq3ZYkKWfzIzcsY/yQozTmAy6R45GKwz2749eiq/Ia5s1BPlpp10EnC+WEpFkJ60rE+ljHNmq3rG2ZLa+irmyaiaNRq21fDqGoc8u+/hc8RkP1u7auu5e3qtQcNoSVSKf6rRWF6tP4vtDTIKEmtVxu3e+7QC6eSM98+OesOv46vSyqZfbna1rHI9HYjX412qHqGWUdo6q7fmqEdiVsbtxYyGiYqv0aCt2KvrNY3h8/rs5ijRXXN5n+4nzx7/IoP1cKSodfFD/JPZvx3rs2z00KlIEUv6pHXR1pXl0j2ts/saR15I3OyV6StPCrIxKLQVm7VtPyq+RoO2Yq8uM6XPfo7yigz3RMizpI8dF/vTQ8n+mehJlHePCf8kuW9sXS7oczumc92Yi6ho/upDo0oJ1+/fFLsjRxm9mLeqYzFRDWvEtNXw6hpz/tnNUaLvn4Nn8xlyrwMz5/yy/DPQlOi1+mzOJdb0uWU54EvJ81cLo/FadsRdhnxf+Sg/sezoM2vMTlQzNdr6bTVzdYHp9ef1+owTjWLm3Go39iMccf4ZqHdxxfonuae1LzU1/2lU6k36PLYuzyBze5zyz3ZUwxrlkLZ66uo89fo5/t7YOMN/jz4bE5NWuzE7t9k7hflngLTItfq8bP1Z9nVyG5/71rmcsaOMvg5Z1z07ljFR8TUathVz9RWOGW4eVWiDd+qzWgXU7TZTQaH+GSh2F3h9Zs1xfO1R9Ll8YdNbk6zps9qELHaAuPmPSiaRtmrqAyQuNwsbSHW+yUgfjw2yZidrQiYqvkbjtupfDQc/a3KlW/3P5CjxvH8Wvn2c+TlznGzVM8RO8FL9M0dn39/21hL6/MDSWx2XMekM2hmVncvV3zmU67HqIKd7VVtrzuOvx8RpYXFPdnRGJpnMZvUZ+ZP6TMWRE5F8FRr73Bk8Heb4qHo14ttqfPW1j5nLqBo16uWIyf74WX2eIe97/Brk8eQG2E3+ib//lMrwmO4u+H2UD8Pc+PefQDJi9cmcjYNJ8P8P/WzKNYIUMQy/LQOTwD8BkAv8EwC5wD8BkAv8EwC5wD8BkAv8EwC5/AXfkfTWsTSezQAAAABJRU5ErkJggg==" alt="" />

    6)limit的实现

def db_op(request):
#返回单个记录
pub=Publisher.objects.order_by("name")[0]
print pub #返回记录列表
publisher_list=Publisher.objects.order_by("name")[0:100]
print publisher_list return render_to_response('db_op.html', locals())

     执行结果:

     aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAl8AAABHCAIAAAC2x7WVAAAON0lEQVR4nO2dPW7kPAyGv/Nw+mknnYEgXTJdAKXLYvcAzil8g1S+xQyQo+xV9isk2xJNUbJsj53J+2CLzfhH1A9JkZLt/w4AAAAACPnvfD5vLQMAAACwL/7bWgAAAABgdyB2B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P3C0aN5RbclkO4/7iI3/HJl1DZ1atZnMsTmZFiklgKaDss35ad6xIHbspy3dacHkJb8FE1Pp1bzjuNyPszA160eqXl/vtlH9scpPi3rHHHV1+bqIkc2UStz7F7tzTu8ny13WO9r8FYuG/RU+HpdE4gBmzqaSDMJ26B2nrt4p3jH5o35U8I6R8aPIvDfvWGxzMi2SQlIH4R0PBbEjm+NY/N6i4+NXZm5NVX6mD2wlptsq9jpMLd3RITMgaqBY7sf5fZy3sXYqWd+emP70k9kFvaMolVB03DtmShULHKPeMdX7OeUu7B0jQcZwwmikLe4do2mYYLieJO84LE1NKj1IkYl6lFqxLtiUd1PvKHWrLvPuvGORzcm3SDFydDCWr8qx7XfD//sd+PBHfKH8AAAAAElFTkSuQmCC" alt="" />

    7)更新记录中的某些字段,而不是所有字段

       使用结果集QuerySet的update()方法,而不是p.save()

def db_op(request):
#返回记录列表
affectRowCount=Publisher.objects.filter(name__contains='e').update(country='Japan')
print affectRowCount publisher_list=Publisher.objects.all()
print publisher_list return render_to_response('db_op.html', locals())

      执行结果:

      aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAlAAAAA0CAIAAADKepF3AAAHXUlEQVR4nO2dwaGrIBBFfz1YiBW8NWXYBU3YhTb3FygiwoAJmBjP2b2nKOBchhkw/usAAAAewL+/v79P1wEAAKA5/1IHlNJmmuZ5nud5msahV1dWCwAAoC7xCE/1w+g5uX4Y8XkAAHBr4hGeNtM49O5PtTrAq2oFAABQmXiEp800GR38B4cHAAD3JRnhTZPRaslh2gjPaFKaAABwV4p2aSob3ykcHgAA3JXkLk2HUtp40R4AAMAdyUR4eDsAAPgNpAgPbwcAAD9DMsLD2wEAwC8Rj/CU6odx5+2U6odBR08GAAD4flLv4YW/q6K04T08AAC4L5EIz/8VTR/ewwMAgPvC1xIAAOAR5N/DAwAA+AGI8AAA4BEQ4QEAwCMgwgMAgEdAhAcAAI+ACA8AAB4BER4AADwCIjwAAHgERHgAAPAIiPAAAOAREOEBAMAj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KQq3r7SxosKkGu/0YelxWz1qOUKtsi4S+yh6twu101HyXZlRvdcUWDV1fHoiT+f10d0c3j4SXPTzX96m4hhfNDpWEiU0cnvN4Nr5rsCSeWMHaNspHZpcRofrZldKyKaG28HYWNLic30CDfm03n+SHKaLlCLUq1GCqr0qOvs/tdHTFe3h+hmqr01fOLoNzYgv1ydmlPFo1cXhVd2kGTci2yNLC4blDjfKZXSI9spuYFwl1SwiXl40KNZourgga7No5PG38pxmaVlGEF69VoQYtQV+dOvoyt9PRRb+0Ehh3XbFVWz/YG25wmtzda1i1C8yH9MOrRTQVWSgSOUWebZE7rYXDszGebpPP7I5CPaSVskJ1PX+27FGoJUP/+6DBZhrcWenZyYFQK7lF2b4Sjtbidjq67rc0fd+bEZsf5HpLuq6sn5iOrmN1r4rtsM1ptyQudPdSz/UEZeNqMVUda/XpFXXhl1byZQN72s+wsi1yd2zi8PZ394vMNX7E6DAz1f5On3UjvtFq2W5urc43YGeEJWXluETuoirtdVdDg3U1eBxAQx2lLSdbK7lF+b5KH32ajrYKXxPh+fTe7/illprcOdM0Dv2Shl76RRujlTaRVc1u7aZdPv3wPJJH+2HQ/eD9RlxgtfPhjZndOWorG+Q0gmXn6IN5ZwvZ1hvFxb0Wbaqw3b6ZY6JF+Z5846hfw+iA+NqCRLC0eYyM7QlefZa2O6uzlnjsNLlsieVI1W7zA5JosIoG3e2CFwmWCvjDdMxySmolaTDdV/mjD9PRvj/fjPD4Hh40QOkhms+UF6XTV9smvMGrfqXFa3udE7dGVrflg5Yj8ygd6VrfwwNoROpDMNE9h0UX9Iz+7BU+OGy93F74Br7W4T1NR+VIER5AXVwmLbLhOP3mzTVVarHPTeBT7YVafMpyZJ6mo7MQ4QEAwCMgwgMAgEdAhAcAAI+ACA8AAN7CLuB9uhZ5/gPiYceCZwg4/QAAAABJRU5ErkJggg==" alt="" />

    8)删除一些记录,而不是单条记录

       使用 使用结果集QuerySet的delete()方法,而不是先get单条p,再p.delete()

def db_op(request):
#返回记录列表
affectRowCount=Publisher.objects.filter(name='Apress').delete()
print affectRowCount publisher_list=Publisher.objects.all()
print publisher_list return render_to_response('db_op.html', locals())

      执行结果:

      aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAATUAAAA1CAIAAACvCuvnAAAF00lEQVR4nO2d3aGkIAyFtx4oxDIogy5owi60uX1AMEAI+MOVvXu+txllBOSYBJzwRwMAZuXP1xUAAFSBPgGYF+gTgHk59GnXbd/3zZl4QBm37/u+79tqF6U+qh4A/zWn/Vzsuu+7M6cUlTLWLl/UCgCgdapP69xGrSX0CcC3JPo0yrhtiyYU+gTgWzJ9qsWu2+aMUrrQpz94BKXhHB0i1W21CzlhLYRtXCy72gUBLQBtcn0qZbyTq1N90u+11lTGWmtl3LauaxCeWuxKROiFTc2yg0QB6CDXp/Zi82Eo0ad3fGlJ+k3wiyuCNC4zp/7wmBYB8Hvg9Hk6uYc+VRqXeqgmg0Xk9Rk9WwqWbQBowuhTh5DSGarP3CMNGmzoUwVn92faA8Bvgten9u7rurqX7Ce8WQBuUNWnd3JXEn8KMaSsz2wySWPlBoA+qvrUqSYzE5pPCIn6VFHrYdnGpXIFALAk79/K7/d5idbWP+OX9DQib37tFAAggP+vADAv0CcA8wJ9AjAv0CcA8wJ9AjAv0CcA8wJ9AjAv0CcA8wJ9AjAv0CcA8wJ9AjAv0CcA8wJ9AjAv0CcA85Lrk/47LNvxAXyOz/GPZDH/LjQXV88fLTl9InPXrJBUw7hB/zZKLXYdqU+fBeF+BQnGfjPgvrruE17sdjACnxykedpYfdJR4p2ujE4fzJcVDAKbjaE4Z7Hrdiktw8yGSM41Ubv9MYtFksT0opJrPSnfhZ57NAjaV1fH3jh6JDpQn2V2aTY/defgyHIXCRd9UZ/91/1hsq5Lt9tIsjoxZUnG0/DxWubEZk8Kd6F5dCjZCPycMp9exih9sveg7J1siwepoo/1eY859Rm6LU102vmkS/XJ/trz6kGfnci9MUSftacCo8/uTVZ+qz4PU3TlEmwu7/6RB31OpU8t7mP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3RYrAAAAAElFTkSuQmCC" alt="" />

     ps:不会返回被删除的行数

   参考:http://djangobook.py3k.cn/2.0/chapter05/

上一篇:利用CocoaHttpServer搭建手机本地服务器


下一篇:使用BeanUtils封装数据时数据类型的转换