mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #31007 -- Allowed specifying type of auto-created primary keys.
This also changes the default type of auto-created primary keys for new apps and projects to BigAutoField.
This commit is contained in:
parent
b960e4ed72
commit
b5e12d490a
28 changed files with 415 additions and 11 deletions
|
@ -61,6 +61,7 @@ class AdminScriptTestCase(SimpleTestCase):
|
|||
settings_file.write("%s\n" % extra)
|
||||
exports = [
|
||||
'DATABASES',
|
||||
'DEFAULT_AUTO_FIELD',
|
||||
'ROOT_URLCONF',
|
||||
'SECRET_KEY',
|
||||
]
|
||||
|
@ -2188,6 +2189,20 @@ class StartApp(AdminScriptTestCase):
|
|||
"won't replace conflicting files."
|
||||
)
|
||||
|
||||
def test_template(self):
|
||||
out, err = self.run_django_admin(['startapp', 'new_app'])
|
||||
self.assertNoOutput(err)
|
||||
app_path = os.path.join(self.test_dir, 'new_app')
|
||||
self.assertIs(os.path.exists(app_path), True)
|
||||
with open(os.path.join(app_path, 'apps.py')) as f:
|
||||
content = f.read()
|
||||
self.assertIn('class NewAppConfig(AppConfig)', content)
|
||||
self.assertIn(
|
||||
"default_auto_field = 'django.db.models.BigAutoField'",
|
||||
content,
|
||||
)
|
||||
self.assertIn("name = 'new_app'", content)
|
||||
|
||||
|
||||
class DiffSettings(AdminScriptTestCase):
|
||||
"""Tests for diffsettings management command."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue