Management commands

./manage.py clean_daguerre

Cleans out extra data stored by daguerre:

  • AdjustedImages and Areas that reference storage paths which no longer exist.
  • Duplicate AdjustedImages.
  • Adjusted image files which don’t have an associated AdjustedImage.

./manage.py preadjust [--remove]

Looks for a DAGUERRE_PREADJUSTMENTS setting using the following syntax:

DAGUERRE_PREADJUSTMENTS = {
    ('myapp.MyModel', 'template.style.lookup'): (
        {'adjustment': 'fit',
         'width': 800,
         'height': 500},
        {'adjustment': 'fill',
         'width': 300,
         'height': 216},
        ...
    ),
}

In this dictionary, the values are lists of adjustment keyword arguments. The keys are tuples where the first value is either an '<applabel>.<ModelName>' string, a model class, or a queryset, and the second value is a template-style lookup which can be applied to each item of the given model type in order to get an ImageFieldFile or a storage path.

The command will collect storage paths based on the keys and make AdjustedImages for each one based on the list of kwargs, if such an AdjustedImage doesn’t already exist.

If --remove is specified, the command will delete all AdjustedImage instances which do not match one of the model/lookup/kwargs combinations specified in DAGUERRE_PREADJUSTMENTS.