magic-removal: Fixed some model tests that broke with removal of pluralization in [2111].

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2125 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Joseph Kocherhans 2006-01-25 21:51:13 +00:00
parent 650d26d32e
commit faf9ff6316
6 changed files with 16 additions and 17 deletions

View File

@ -29,7 +29,7 @@ class Article(models.Model):
cursor = connection.cursor()
cursor.execute("""
SELECT id, headline, pub_date
FROM custom_methods_articles
FROM custom_methods_article
WHERE pub_date = %s
AND id != %s""", [str(self.pub_date), self.id])
# The asterisk in "(*row)" tells Python to expand the list into

View File

@ -22,7 +22,6 @@ class Business(models.Model):
employees = models.ManyToManyField(Employee)
class Meta:
verbose_name_plural = 'businesses'
module_name = 'businesses'
def __repr__(self):
return self.name
@ -77,9 +76,9 @@ True
[Sears]
# Queries across tables, involving primary key
>>> Employee.objects.get_list(businesses__name__exact='Sears')
>>> Employee.objects.get_list(business__name__exact='Sears')
[Dan Jones, Fran Jones]
>>> Employee.objects.get_list(businesses__pk='Sears')
>>> Employee.objects.get_list(business__pk='Sears')
[Dan Jones, Fran Jones]
>>> Business.objects.get_list(employees__employee_code__exact='ABC123')

View File

@ -88,7 +88,7 @@ Ultimate Ella
datetime.date(2005, 2, 13)
# Test follow (inline editing) functionality.
>>> man = Musician.ChangeManipulator(m1, follow={"albums": True})
>>> man = Musician.ChangeManipulator(m1, follow={"album": True})
>>> data = man.flatten_data()
>>> sorted_list = data.items()
>>> sorted_list.sort(lambda x, y: cmp(x[0], y[0]))

View File

@ -85,13 +85,13 @@ True
>>> Publication.objects.get_list(pk=1)
[The Python Journal]
>>> Publication.objects.get_list(articles__headline__startswith="NASA")
>>> Publication.objects.get_list(article__headline__startswith="NASA")
[The Python Journal, Science News, Science Weekly]
>>> Publication.objects.get_list(articles__id__exact=1)
>>> Publication.objects.get_list(article__id__exact=1)
[The Python Journal]
>>> Publication.objects.get_list(articles__pk=1)
>>> Publication.objects.get_list(article__pk=1)
[The Python Journal]
# If we delete a Publication, its Articles won't be able to access it.

View File

@ -98,7 +98,7 @@ This is a test
1
# The automatically joined table has a predictable name.
>>> Article.objects.get_list(reporter__first_name__exact='John', where=["many_to_one_articles__reporter.last_name='Smith'"])
>>> Article.objects.get_list(reporter__first_name__exact='John', where=["many_to_one_article__reporter.last_name='Smith'"])
[This is a test, John's second story]
# Find all Articles for the Reporter whose ID is 1.
@ -147,19 +147,19 @@ John Smith
[John Smith]
# Reporters can query in opposite direction of ForeignKey definition
>>> Reporter.objects.get_list(articles__id__exact=1)
>>> Reporter.objects.get_list(article__id__exact=1)
[John Smith]
>>> Reporter.objects.get_list(articles__pk=1)
>>> Reporter.objects.get_list(article__pk=1)
[John Smith]
>>> Reporter.objects.get_list(articles__headline__startswith='This')
>>> Reporter.objects.get_list(article__headline__startswith='This')
[John Smith, John Smith, John Smith]
>>> Reporter.objects.get_list(articles__headline__startswith='This', distinct=True)
>>> Reporter.objects.get_list(article__headline__startswith='This', distinct=True)
[John Smith]
# Queries can go round in circles.
>>> Reporter.objects.get_list(articles__reporter__first_name__startswith='John')
>>> Reporter.objects.get_list(article__reporter__first_name__startswith='John')
[John Smith, John Smith, John Smith, John Smith]
>>> Reporter.objects.get_list(articles__reporter__first_name__startswith='John', distinct=True)
>>> Reporter.objects.get_list(article__reporter__first_name__startswith='John', distinct=True)
[John Smith]
# Deletes that require joins are prohibited.

View File

@ -79,9 +79,9 @@ Demon Dogs the restaurant
Demon Dogs the place
>>> Place.objects.get_object(pk=1)
Demon Dogs the place
>>> Place.objects.get_object(restaurants__place__exact=1)
>>> Place.objects.get_object(restaurant__place__exact=1)
Demon Dogs the place
>>> Place.objects.get_object(restaurants__pk=1)
>>> Place.objects.get_object(restaurant__pk=1)
Demon Dogs the place
# Add a Waiter to the Restaurant.