“Django Bulk Update” Code-Antworten

Django Bulk Update

objs = []
for person in p:
    obj = People.objects.get(email=person['email'])
    obj.birthday = person['birthday']
    objs.append(obj)
People.objects.bulk_update(objs, ['birthday'], batch_size=1000)
Confused Curlew

Python Django wie man Bulk Update

from django.db import models

class Person(models.Model):
    username = models.CharField(max_length = 200, unique = True)
    firstName = models.CharField(max_length = 200)
    middleName = models.CharField(max_length = 200)
    lastName = models.CharField(max_length = 200)
    age = models.IntegerField(default = 0)
thecodeteacher

Ähnliche Antworten wie “Django Bulk Update”

Fragen ähnlich wie “Django Bulk Update”

Weitere verwandte Antworten zu “Django Bulk Update” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen