2.9Django basic CRUD

Add the appropriate correspondence relationship urls, wrote in the respective deletions in the views change search Code:

 

 views in the corresponding code:

Models app01 Import from 

DEF ORM (Request):
# increasing the data
# first:
# models.UserInfo.objects.create (username = 'the root', password = 'the root')
# The second:
# = obj Models .UserInfo (username = 'Xiaoyu', password = '123456')
# obj.save ()


# query data #
# # result = models .UserInfo .objects.all ( ) Search
# result = models.UserInfo.objects.filter (username = 'root')
# for the kill in the Result: print out their #
# Print (kill.id, kill.username, kill.password)
# Print (the Result)


# # deleted data
# models.UserInfo.objects.filter (# inside plus what needed) .Delete ()


# # update data changes
# Models.UserInfo.objects.filter (). Update (# changes needed which added)

return the HttpResponse ( 'ORM')

 

Guess you like

Origin www.cnblogs.com/y862621115/p/12287575.html