=== added file 'tests/regressiontests/fixtures_regress/tests.py'
|
|
|
|
| | 1 | import unittest |
| | 2 | from django.core import management |
| | 3 | |
| | 4 | class Fixtures(unittest.TestCase): |
| | 5 | def test_flush_with_upper_case_letter_in_app_name(self): |
| | 6 | # We could call django.core.managment.flush() here, but it catches the |
| | 7 | # error and prints to stderr, which won't be seen when running tests. |
| | 8 | # Also note that the test runner might not get this far if you are |
| | 9 | # running tests for more than just the fixtures_regress package since |
| | 10 | # management.flush() calls elsewhere will terminate runtests with the |
| | 11 | # same error seen here. |
| | 12 | from django.db import connection |
| | 13 | cursor = connection.cursor() |
| | 14 | for sql in management.get_sql_flush(): |
| | 15 | cursor.execute(sql) |
=== modified file 'django/db/backends/postgresql/base.py'
|
|
|
|
| 192 | 192 | sql.append("%s %s %s %s %s %s;" % \ |
| 193 | 193 | (style.SQL_KEYWORD('ALTER'), |
| 194 | 194 | style.SQL_KEYWORD('SEQUENCE'), |
| 195 | | style.SQL_FIELD('%s_%s_seq' % (table_name, column_name)), |
| | 195 | style.SQL_FIELD(quote_name('%s_%s_seq' % (table_name, column_name))), |
| 196 | 196 | style.SQL_KEYWORD('RESTART'), |
| 197 | 197 | style.SQL_KEYWORD('WITH'), |
| 198 | 198 | style.SQL_FIELD('1') |
| … |
… |
|
| 203 | 203 | sql.append("%s %s %s %s %s %s;" % \ |
| 204 | 204 | (style.SQL_KEYWORD('ALTER'), |
| 205 | 205 | style.SQL_KEYWORD('SEQUENCE'), |
| 206 | | style.SQL_FIELD('%s_id_seq' % table_name), |
| | 206 | style.SQL_FIELD(quote_name('%s_id_seq' % table_name)), |
| 207 | 207 | style.SQL_KEYWORD('RESTART'), |
| 208 | 208 | style.SQL_KEYWORD('WITH'), |
| 209 | 209 | style.SQL_FIELD('1') |
=== modified file 'django/db/backends/postgresql_psycopg2/base.py'
|
|
|
|
| 149 | 149 | sql.append("%s %s %s %s %s %s;" % \ |
| 150 | 150 | (style.SQL_KEYWORD('ALTER'), |
| 151 | 151 | style.SQL_KEYWORD('SEQUENCE'), |
| 152 | | style.SQL_FIELD('%s_%s_seq' % (table_name, column_name)), |
| | 152 | style.SQL_FIELD(quote_name('%s_%s_seq' % (table_name, column_name))), |
| 153 | 153 | style.SQL_KEYWORD('RESTART'), |
| 154 | 154 | style.SQL_KEYWORD('WITH'), |
| 155 | 155 | style.SQL_FIELD('1') |
| … |
… |
|
| 160 | 160 | sql.append("%s %s %s %s %s %s;" % \ |
| 161 | 161 | (style.SQL_KEYWORD('ALTER'), |
| 162 | 162 | style.SQL_KEYWORD('SEQUENCE'), |
| 163 | | style.SQL_FIELD('%s_id_seq' % table_name), |
| | 163 | style.SQL_FIELD(quote_name('%s_id_seq' % table_name)), |
| 164 | 164 | style.SQL_KEYWORD('RESTART'), |
| 165 | 165 | style.SQL_KEYWORD('WITH'), |
| 166 | 166 | style.SQL_FIELD('1') |
=== modified file 'tests/regressiontests/fixtures_regress/models.py'
|
|
|
|
| 7 | 7 | def __str__(self): |
| 8 | 8 | return self.common_name |
| 9 | 9 | |
| | 10 | class Plant(models.Model): |
| | 11 | name = models.CharField(maxlength=150) |
| | 12 | |
| | 13 | class Meta: |
| | 14 | # For testing when upper case letter in app name. |
| | 15 | db_table = "Fixtures_regress_plant" |
| | 16 | |
| 10 | 17 | __test__ = {'API_TESTS':""" |
| 11 | 18 | >>> from django.core import management |
| 12 | 19 | |