Search and delete of ORM database

Source: Internet
Author: User

Database Visualization Tools:

Https://sqlitestudio.pl/index.rvt

From APP01 import modelsdef orm (Request):    #增加数据    # method 1:    # models. UserInfo.objects.create (username= ' root ', password= ' root123 ')    # method 2:    # obj = models. UserInfo (username= ' ZTE ', password= ' ZTE ')    # obj.save ()    # method Three:    # dict1={' username ': ' zte1 ', ' Password ': ' Zte1 '}    # obj = models. UserInfo (**dict1)    # obj.save ()    #查找数据    # result=models. UserInfo.objects.all ()    # # Print result    # for row in result:    #     Print Row.id,row.username, Row.password    # result = models. UserInfo.objects.filter (username= ' root ')    # result = models. UserInfo.objects.filter (username= ' root ', password= ' root123 ')    # for row in result:    #     Print row.id, Row.username,row.password    #删除    # models. UserInfo.objects.filter (id= ' 4 '). Delete ()    #更新    models. UserInfo.objects.all (). Update (password=45678)    return HttpResponse (' ADASD ')

  

#-*-Coding:utf-8-*-from __future__ import unicode_literalsfrom django.db import models# Create your models Here.class UserInfo (models. Model):    username=models. Charfield (max_length=32)    password=models. Charfield (MAX_LENGTH=64) class ZTE (models. Model):    id=models. Autofield (primary_key=true)  #主键, self-increasing    username=models. Charfield (max_length=32)    password=models. Charfield (max_length=64)    email=models. Charfield (Max_length=64,null=true)

  

Search and delete of ORM database

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.