Ticket #4492: add-quote_name_r5988.diff

File add-quote_name_r5988.diff, 2.9 KB (added by John Shaffer <jshaffer2112@…>, 8 years ago)

Patch against [5988].

  • django/db/backends/postgresql/operations.py

     
    105105                    style.SQL_FIELD(qn('id')),
    106106                    style.SQL_KEYWORD('IS NOT'),
    107107                    style.SQL_KEYWORD('FROM'),
    108                     style.SQL_TABLE(f.m2m_db_table())))
    109         return output
    110  No newline at end of file
     108                    style.SQL_TABLE(qn(f.m2m_db_table()))))
     109        return output
  • 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

     
    2020    class Meta:
    2121        ordering = ('-pub_date', 'headline')
    2222
     23class 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
    2333__test__ = {'API_TESTS': """
    2434>>> from django.core import management
    2535>>> from django.db.models import get_app
     
    7585# Dump the current contents of the database as a JSON fixture
    7686>>> management.call_command('dumpdata', 'fixtures', format='json')
    7787[{"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.call_command('loaddata', '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>]
    7896"""}
    7997
    8098from django.test import TestCase
Back to Top