mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	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:
		| @@ -29,7 +29,7 @@ class Article(models.Model): | |||||||
|         cursor = connection.cursor() |         cursor = connection.cursor() | ||||||
|         cursor.execute(""" |         cursor.execute(""" | ||||||
|             SELECT id, headline, pub_date |             SELECT id, headline, pub_date | ||||||
|             FROM custom_methods_articles |             FROM custom_methods_article | ||||||
|             WHERE pub_date = %s |             WHERE pub_date = %s | ||||||
|                 AND id != %s""", [str(self.pub_date), self.id]) |                 AND id != %s""", [str(self.pub_date), self.id]) | ||||||
|         # The asterisk in "(*row)" tells Python to expand the list into |         # The asterisk in "(*row)" tells Python to expand the list into | ||||||
|   | |||||||
| @@ -22,7 +22,6 @@ class Business(models.Model): | |||||||
|     employees = models.ManyToManyField(Employee) |     employees = models.ManyToManyField(Employee) | ||||||
|     class Meta: |     class Meta: | ||||||
|         verbose_name_plural = 'businesses' |         verbose_name_plural = 'businesses' | ||||||
|         module_name = 'businesses' |  | ||||||
|  |  | ||||||
|     def __repr__(self): |     def __repr__(self): | ||||||
|         return self.name |         return self.name | ||||||
| @@ -77,9 +76,9 @@ True | |||||||
| [Sears] | [Sears] | ||||||
|  |  | ||||||
| # Queries across tables, involving primary key | # 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] | [Dan Jones, Fran Jones] | ||||||
| >>> Employee.objects.get_list(businesses__pk='Sears') | >>> Employee.objects.get_list(business__pk='Sears') | ||||||
| [Dan Jones, Fran Jones] | [Dan Jones, Fran Jones] | ||||||
|  |  | ||||||
| >>> Business.objects.get_list(employees__employee_code__exact='ABC123') | >>> Business.objects.get_list(employees__employee_code__exact='ABC123') | ||||||
|   | |||||||
| @@ -88,7 +88,7 @@ Ultimate Ella | |||||||
| datetime.date(2005, 2, 13) | datetime.date(2005, 2, 13) | ||||||
|  |  | ||||||
| # Test follow (inline editing) functionality. | # Test follow (inline editing) functionality. | ||||||
| >>> man = Musician.ChangeManipulator(m1, follow={"albums": True}) | >>> man = Musician.ChangeManipulator(m1, follow={"album": True}) | ||||||
| >>> data = man.flatten_data() | >>> data = man.flatten_data() | ||||||
| >>> sorted_list = data.items() | >>> sorted_list = data.items() | ||||||
| >>> sorted_list.sort(lambda x, y: cmp(x[0], y[0])) | >>> sorted_list.sort(lambda x, y: cmp(x[0], y[0])) | ||||||
|   | |||||||
| @@ -85,13 +85,13 @@ True | |||||||
| >>> Publication.objects.get_list(pk=1) | >>> Publication.objects.get_list(pk=1) | ||||||
| [The Python Journal] | [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] | [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] | [The Python Journal] | ||||||
|  |  | ||||||
| >>> Publication.objects.get_list(articles__pk=1) | >>> Publication.objects.get_list(article__pk=1) | ||||||
| [The Python Journal] | [The Python Journal] | ||||||
|  |  | ||||||
| # If we delete a Publication, its Articles won't be able to access it. | # If we delete a Publication, its Articles won't be able to access it. | ||||||
|   | |||||||
| @@ -98,7 +98,7 @@ This is a test | |||||||
| 1 | 1 | ||||||
|  |  | ||||||
| # The automatically joined table has a predictable name. | # 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] | [This is a test, John's second story] | ||||||
|  |  | ||||||
| # Find all Articles for the Reporter whose ID is 1. | # Find all Articles for the Reporter whose ID is 1. | ||||||
| @@ -147,19 +147,19 @@ John Smith | |||||||
| [John Smith] | [John Smith] | ||||||
|  |  | ||||||
| # Reporters can query in opposite direction of ForeignKey definition | # 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] | [John Smith] | ||||||
| >>> Reporter.objects.get_list(articles__pk=1) | >>> Reporter.objects.get_list(article__pk=1) | ||||||
| [John Smith] | [John Smith] | ||||||
| >>> Reporter.objects.get_list(articles__headline__startswith='This') | >>> Reporter.objects.get_list(article__headline__startswith='This') | ||||||
| [John Smith, John Smith, John Smith] | [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] | [John Smith] | ||||||
|  |  | ||||||
| # Queries can go round in circles. | # 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] | [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] | [John Smith] | ||||||
|  |  | ||||||
| # Deletes that require joins are prohibited. | # Deletes that require joins are prohibited. | ||||||
|   | |||||||
| @@ -79,9 +79,9 @@ Demon Dogs the restaurant | |||||||
| Demon Dogs the place | Demon Dogs the place | ||||||
| >>> Place.objects.get_object(pk=1) | >>> Place.objects.get_object(pk=1) | ||||||
| Demon Dogs the place | Demon Dogs the place | ||||||
| >>> Place.objects.get_object(restaurants__place__exact=1) | >>> Place.objects.get_object(restaurant__place__exact=1) | ||||||
| Demon Dogs the place | Demon Dogs the place | ||||||
| >>> Place.objects.get_object(restaurants__pk=1) | >>> Place.objects.get_object(restaurant__pk=1) | ||||||
| Demon Dogs the place | Demon Dogs the place | ||||||
|  |  | ||||||
| # Add a Waiter to the Restaurant. | # Add a Waiter to the Restaurant. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user