From a03a8adb3e46a2df78de604340e729766ae2c18a Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Sun, 12 Dec 2010 22:58:25 +0000 Subject: [PATCH] Fixed #14268 -- Start the deprecation of the reset and sqlreset management command. Thanks, Carl. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14888 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/management/commands/reset.py | 6 ++++++ django/core/management/sql.py | 6 ++++++ docs/internals/deprecation.txt | 3 +++ docs/ref/django-admin.txt | 8 ++++++++ docs/releases/1.3.txt | 7 +++++++ 5 files changed, 30 insertions(+) diff --git a/django/core/management/commands/reset.py b/django/core/management/commands/reset.py index 475fd25c1f..388045f726 100644 --- a/django/core/management/commands/reset.py +++ b/django/core/management/commands/reset.py @@ -20,6 +20,12 @@ class Command(AppCommand): output_transaction = True def handle_app(self, app, **options): + # This command breaks a lot and should be deprecated + import warnings + warnings.warn( + 'This command has been deprecated. The command ``flush`` can be used to delete everything. You can also use ALTER TABLE or DROP TABLE statements manually.', + PendingDeprecationWarning + ) using = options.get('database', DEFAULT_DB_ALIAS) connection = connections[using] diff --git a/django/core/management/sql.py b/django/core/management/sql.py index 01fc20fd4c..429f470637 100644 --- a/django/core/management/sql.py +++ b/django/core/management/sql.py @@ -98,6 +98,12 @@ def sql_delete(app, style, connection): def sql_reset(app, style, connection): "Returns a list of the DROP TABLE SQL, then the CREATE TABLE SQL, for the given module." + # This command breaks a lot and should be deprecated + import warnings + warnings.warn( + 'This command has been deprecated. The command ``sqlflush`` can be used to delete everything. You can also use ALTER TABLE or DROP TABLE statements manually.', + PendingDeprecationWarning + ) return sql_delete(app, style, connection) + sql_all(app, style, connection) def sql_flush(style, connection, only_django=False): diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt index 1f5758c877..4cd4807188 100644 --- a/docs/internals/deprecation.txt +++ b/docs/internals/deprecation.txt @@ -136,6 +136,9 @@ their deprecation, as per the :ref:`Django deprecation policy template variable, not an implied string. The new-style behavior is provided in the ``future`` template tag library. + * The :djadmin:`reset` and :djadmin:`sqlreset` management commands + are deprecated. + * 2.0 * ``django.views.defaults.shortcut()``. This function has been moved to ``django.contrib.contenttypes.views.shortcut()`` as part of the diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt index 821b37fc5a..37e12c4cd8 100644 --- a/docs/ref/django-admin.txt +++ b/docs/ref/django-admin.txt @@ -491,6 +491,10 @@ several lines in language files. reset --------------------------- +.. deprecated:: 1.3 + This command has been deprecated. The ``flush`` can be used to delete + everything. You can also use ALTER TABLE or DROP TABLE statements manually. + .. django-admin:: reset Executes the equivalent of ``sqlreset`` for the given app name(s). @@ -844,6 +848,10 @@ which to print the SQL. sqlreset ------------------------------ +.. deprecated:: 1.3 + This command has been deprecated. The ``sqlflush`` can be used to delete + everything. You can also use ALTER TABLE or DROP TABLE statements manually. + .. django-admin:: sqlreset Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app name(s). diff --git a/docs/releases/1.3.txt b/docs/releases/1.3.txt index 0c2dedc481..f1a33b434c 100644 --- a/docs/releases/1.3.txt +++ b/docs/releases/1.3.txt @@ -468,3 +468,10 @@ in favor of a new :attr:`~django.contrib.admin.AdminSite.login_form` attribute. .. _r12634: http://code.djangoproject.com/changeset/12634 + +``reset`` and ``sqlreset`` management commands +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Those commands have been deprecated. The ``flush`` and ``sqlflush`` commands +can be used to delete everything. You can also use ALTER TABLE or DROP TABLE +statements manually.