django_evolution.placeholders

Placeholder objects for hinted evolutions.

New in version 2.2.

Classes

BasePlaceholder([app_label, model_name, ...])

A placeholder object for use in generating hints.

NullFieldInitialCallback([app_label, ...])

A placeholder for an initial value for a field.

class django_evolution.placeholders.BasePlaceholder(app_label=None, model_name=None, field_name=None)

Bases: object

A placeholder object for use in generating hints.

Placeholder objects provide stand-ins for values that must be hand-added to the evolution file.

New in version 2.2.

placeholder_text = None

The text used in the placeholder.

Type:

unicode

__init__(app_label=None, model_name=None, field_name=None)

Initialize the object.

Parameters:
  • app_label (unicode, optional) – The label of the application owning the model.

  • model_name (unicode, optional) – The name of the model owning the field.

  • field_name (unicode, optional) – The name of the field to return an initial value for.

__repr__()

Return a string representation of the object.

This is used when outputting the value in a hinted evolution.

Returns:

The placeholder text.

Return type:

unicode

__call__()

Handle calls on this object.

This will raise an exception stating that the evolution cannot be performed.

Raises:

django_evolution.errors.EvolutionException – An error stating that an explicit initial value must be provided in place of this object.

class django_evolution.placeholders.NullFieldInitialCallback(app_label=None, model_name=None, field_name=None)

Bases: BasePlaceholder

A placeholder for an initial value for a field.

This is used in place of an initial value in mutations for fields that don’t allow NULL values and don’t have an explicit initial value set. It will show up in hinted evolutions as <<USER VALUE REQUIRED>> and will fail to evolve.

placeholder_text = '<<USER VALUE REQUIRED>>'

The text used in the placeholder.

Type:

unicode

__call__()

Handle calls on this object.

This will raise an exception stating that the evolution cannot be performed.

Raises:

django_evolution.errors.EvolutionException – An error stating that an explicit initial value must be provided in place of this object.