django_evolution.evolve.purge_app_task

Task for purging an application.

New in version 2.2: This was previously located in django_evolution.evolve.

Classes

PurgeAppTask(evolver, app_label)

A task for purging an application's tables from the database.

class django_evolution.evolve.purge_app_task.PurgeAppTask(evolver, app_label)

Bases: BaseEvolutionTask

A task for purging an application’s tables from the database.

app_label

The app label for the app to purge.

Type:

unicode

__init__(evolver, app_label)

Initialize the task.

Parameters:
  • evolver (Evolver) – The evolver that will execute the task.

  • app_label (unicode) – The app label for the app to purge.

prepare(**kwargs)

Prepare state for this task.

This will determine if the app’s tables need to be deleted from the database, and prepare the SQL for doing so.

Parameters:

**kwargs (dict, unused) – Keyword arguments passed for task preparation.

execute(cursor=None, sql_executor=None, **kwargs)

Execute the task.

This will delete any tables owned by the application.

Parameters:
  • cursor (django.db.backends.util.CursorWrapper, unused) – The legacy database cursor. This is no longer used.

  • sql_executor (django_evolution.utils.sql.SQLExecutor, optional) – The SQL executor used to run any SQL on the database.

Raises:

django_evolution.errors.EvolutionExecutionError – The evolution task failed. Details are in the error.

__str__()

Return a string description of the task.

Returns:

The string description.

Return type:

unicode