Ticket #4492: ticket-4492_r5743.diff
File ticket-4492_r5743.diff, 3.4 KB (added by , 17 years ago) |
---|
-
django/db/backends/postgresql/base.py
271 271 style.SQL_FIELD(quote_name('id')), 272 272 style.SQL_KEYWORD('IS NOT'), 273 273 style.SQL_KEYWORD('FROM'), 274 style.SQL_TABLE( f.m2m_db_table())))274 style.SQL_TABLE(quote_name(f.m2m_db_table())))) 275 275 return output 276 276 277 277 def typecast_string(s): -
django/db/backends/postgresql_psycopg2/base.py
221 221 style.SQL_FIELD(quote_name('id')), 222 222 style.SQL_KEYWORD('IS NOT'), 223 223 style.SQL_KEYWORD('FROM'), 224 style.SQL_TABLE( f.m2m_db_table())))224 style.SQL_TABLE(quote_name(f.m2m_db_table())))) 225 225 return output 226 226 227 227 OPERATOR_MAPPING = { -
tests/modeltests/fixtures/fixtures/fixture6.json
1 [ 2 { 3 "pk": "7", 4 "model": "fixtures.mixedcasem2m", 5 "fields": { 6 "relatedItems": [], 7 "Title": "Poker has no place on ESPN" 8 } 9 }, 10 { 11 "pk": "9", 12 "model": "fixtures.mixedcasem2m", 13 "fields": { 14 "relatedItems": [7], 15 "Title": "Time to reform copyright" 16 } 17 } 18 ] -
tests/modeltests/fixtures/models.py
20 20 class Meta: 21 21 ordering = ('-pub_date', 'headline') 22 22 23 class MixedCaseM2M(models.Model): 24 relatedItems = models.ManyToManyField('self', blank=True, null=True) 25 Title = models.CharField(maxlength=100, default='Default title') 26 27 def __unicode__(self): 28 return self.Title 29 30 class Meta: 31 ordering = ('Title',) 32 23 33 __test__ = {'API_TESTS': """ 24 34 >>> from django.core import management 25 35 >>> from django.db.models import get_app … … 75 85 # Dump the current contents of the database as a JSON fixture 76 86 >>> print management.dump_data(['fixtures'], format='json') 77 87 [{"pk": "3", "model": "fixtures.article", "fields": {"headline": "Time to reform copyright", "pub_date": "2006-06-16 13:00:00"}}, {"pk": "2", "model": "fixtures.article", "fields": {"headline": "Poker has no place on ESPN", "pub_date": "2006-06-16 12:00:00"}}, {"pk": "1", "model": "fixtures.article", "fields": {"headline": "Python program becomes self aware", "pub_date": "2006-06-16 11:00:00"}}] 88 89 # Load fixture 6: a JSON file with mixed-case column names. 90 >>> management.load_data(['fixture6.json'], verbosity=0) 91 >>> MixedCaseM2M.objects.all() 92 [<MixedCaseM2M: Poker has no place on ESPN>, <MixedCaseM2M: Time to reform copyright>] 93 >>> mixed = MixedCaseM2M.objects.get(Title__icontains='poker') 94 >>> mixed.relatedItems.all() 95 [<MixedCaseM2M: Time to reform copyright>] 78 96 """} 79 97 80 98 from django.test import TestCase