2 Tests for the update() queryset method that allows in-place, multi-object
6 from django
.db
import models
8 class DataPoint(models
.Model
):
9 name
= models
.CharField(max_length
=20)
10 value
= models
.CharField(max_length
=20)
11 another_value
= models
.CharField(max_length
=20, blank
=True)
13 def __unicode__(self
):
14 return unicode(self
.name
)
16 class RelatedPoint(models
.Model
):
17 name
= models
.CharField(max_length
=20)
18 data
= models
.ForeignKey(DataPoint
)
20 def __unicode__(self
):
21 return unicode(self
.name
)
24 class A(models
.Model
):
25 x
= models
.IntegerField(default
=10)
27 class B(models
.Model
):
28 a
= models
.ForeignKey(A
)
29 y
= models
.IntegerField(default
=10)
31 class C(models
.Model
):
32 y
= models
.IntegerField(default
=10)
35 a
= models
.ForeignKey(A
)