Management Commands

./manage.py daguerre clean

Cleans out extra or invalid 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.
  • AdjustedImage instances with missing adjusted image files.

./manage.py daguerre preadjust [--remove] [--nocreate]

Looks for a DAGUERRE_PREADJUSTMENTS setting using the following structure:

from daguerre.adjustments import Fit, Fill
DAGUERRE_PREADJUSTMENTS = (
    ('myapp.MyModel',
     [Fit(width=800, height=500)],
     'template.style.lookup'),
    (OtherModel.objects.filter(field=value),
     [Fill(width=300, height=216)].
     'template.style.lookup'),
    ...
)

Essentially, this is expected to be an iterable of tuples, where each tuple contains three items:

  1. '<applabel>.<model>', a model class, a queryset, or any iterable.
  2. A non-empty iterable of adjustment instances to be applied to each image.
  3. A template-style lookup (or None).

Each time the command is run, the first item will be used to generate a fresh iterable of model instances. The lookup will be applied to each instance to get an ImageFile or storage path, which will then have the list of adjustments applied it to create a new adjusted version of the image, if one doesn’t exist already. (This is essentially the same functionality as the {% adjust_bulk %} template tag.)

If --remove is specified, the command will delete all AdjustedImage instances which would not be generated by the parameters specified in DAGUERRE_PREADJUSTMENTS.

If --nocreate is specified, the command will not create any new AdjustedImage instances. This can be used with --remove to just prune instances that aren’t specified in DAGUERRE_PREADJUSTMENTS without creating new pre-adjusted instances. Specifying --nocreate without --remove makes this command a no-op.