summaryrefslogtreecommitdiff
path: root/tests/get_or_create/models.py
diff options
context:
space:
mode:
authorPablo Recio <pablo@potatolondon.com>2013-05-19 14:15:36 +0200
committerPablo Recio <pablo@potatolondon.com>2013-05-19 14:16:12 +0200
commit65f9e0affd8ca04e2c597c43c1547ef7c888ec2a (patch)
treea5d498bf2a020c84902698b8175f4eb03ee6ead8 /tests/get_or_create/models.py
parentd34b1c29e294b19e51a47918125314a1540c01d4 (diff)
Fixes #18896. Add tests verifying that you can get IntegrityErrors using get_or_create through relations like M2M, and it also adds a note into the documentation warning about it
Diffstat (limited to 'tests/get_or_create/models.py')
-rw-r--r--tests/get_or_create/models.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/get_or_create/models.py b/tests/get_or_create/models.py
index 82905de4f8..2f21344f59 100644
--- a/tests/get_or_create/models.py
+++ b/tests/get_or_create/models.py
@@ -28,3 +28,12 @@ class ManualPrimaryKeyTest(models.Model):
class Profile(models.Model):
person = models.ForeignKey(Person, primary_key=True)
+
+
+class Tag(models.Model):
+ text = models.CharField(max_length=256, unique=True)
+
+
+class Thing(models.Model):
+ name = models.CharField(max_length=256)
+ tags = models.ManyToManyField(Tag)