# 添加
Fruit.objects.create(name='Apple')
# 更新
UserProfile.objects.filter(user=admin).update(**{'online':False,'channel':''})

# 保存或者更新   defaults 用来更新/保存  user=admin用来查询
UserProfile.objects.update_or_create(defaults={'user':admin,
                                                          'online':True,
                                                          'channel':self.channel_name
                                                          },user=admin)
# 查询
# 单查询
User.objects.get(id=self.admin_id)
# 全部和多查询
Membership.objects.all()
UserProfile.objects.filter(user=admin)
#删除
Line.objects.filter(admin_id=self.admin_id).delete()

 

相关文章:

  • 2021-12-16
  • 2022-02-03
  • 2021-05-20
  • 2022-12-23
  • 2022-12-23
  • 2021-12-27
  • 2022-01-09
  • 2021-09-28
猜你喜欢
  • 2021-09-17
  • 2022-02-07
  • 2021-11-07
  • 2022-12-23
  • 2021-11-20
  • 2021-11-30
  • 2021-11-17
相关资源
相似解决方案