Add more stringent M2M tests and fix the bug they exposed

This commit is contained in:
Andrew Godwin 2013-08-19 13:50:26 +01:00
parent 5b522cd85a
commit 52edc16086
4 changed files with 32 additions and 17 deletions

View file

@ -37,7 +37,7 @@ class BookWithM2M(models.Model):
author = models.ForeignKey(Author)
title = models.CharField(max_length=100, db_index=True)
pub_date = models.DateTimeField()
tags = models.ManyToManyField("Tag", related_name="books")
tags = models.ManyToManyField("TagM2MTest", related_name="books")
class Meta:
app_cache = new_app_cache
@ -62,6 +62,14 @@ class Tag(models.Model):
app_cache = new_app_cache
class TagM2MTest(models.Model):
title = models.CharField(max_length=255)
slug = models.SlugField(unique=True)
class Meta:
app_cache = new_app_cache
class TagIndexed(models.Model):
title = models.CharField(max_length=255)
slug = models.SlugField(unique=True)