From 9fb4d6bf29cd7b7b3e0bdded5ac8f53db41a93df Mon Sep 17 00:00:00 2001 From: Dani Hodovic Date: Tue, 10 Dec 2019 14:07:10 +0100 Subject: [PATCH] Add sane django-extensions defaults 1. When running shell_plus with sql query printing enabled it truncates queries by default. ```sh ./manage.py shell_plus --print-sql ``` Change the truncate setting to present longer strings and to format [sqlparse](https://pypi.org/project/sqlparse/) output. 2. When two modules of the same name are imported the last one will persist. By using collision resolvers we make sure that both are imported with different suffixes. --- {{cookiecutter.project_slug}}/config/settings/base.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/{{cookiecutter.project_slug}}/config/settings/base.py b/{{cookiecutter.project_slug}}/config/settings/base.py index 935a0d12a..e249a067f 100644 --- a/{{cookiecutter.project_slug}}/config/settings/base.py +++ b/{{cookiecutter.project_slug}}/config/settings/base.py @@ -256,6 +256,16 @@ LOGGING = { "root": {"level": "INFO", "handlers": ["console"]}, } +# django-extensions +SHELL_PLUS_PRINT_SQL_TRUNCATE = 10000 +SHELL_PLUS_SQLPARSE_FORMAT_KWARGS = dict( + reindent_aligned=True, + truncate_strings=500 +) +SHELL_PLUS_MODEL_IMPORTS_RESOLVER = ( + "django_extensions.collision_resolvers.AppNameSuffixCustomOrderCR" +) + {% if cookiecutter.use_celery == 'y' -%} # Celery # ------------------------------------------------------------------------------