PageRenderTime 81ms CodeModel.GetById 40ms app.highlight 3ms RepoModel.GetById 37ms app.codeStats 0ms

/tests/modeltests/update/models.py

https://code.google.com/p/mango-py/
Python | 35 lines | 21 code | 10 blank | 4 comment | 0 complexity | 70e5cfe75508c6acaac80d36a9770aab MD5 | raw file
 1"""
 2Tests for the update() queryset method that allows in-place, multi-object
 3updates.
 4"""
 5
 6from django.db import models
 7
 8class 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)
12
13    def __unicode__(self):
14        return unicode(self.name)
15
16class RelatedPoint(models.Model):
17    name = models.CharField(max_length=20)
18    data = models.ForeignKey(DataPoint)
19
20    def __unicode__(self):
21        return unicode(self.name)
22
23
24class A(models.Model):
25    x = models.IntegerField(default=10)
26
27class B(models.Model):
28    a = models.ForeignKey(A)
29    y = models.IntegerField(default=10)
30
31class C(models.Model):
32    y = models.IntegerField(default=10)
33
34class D(C):
35    a = models.ForeignKey(A)