A django field and widgets for setting the focal point of an image
- Add the
ImageFocusField
to your model
# models.py
from django.db import models
from imagefocus import ImageFocusField
class ImageModel(models.Model):
source = models.ImageField(upload_to="/images")
focal_point = ImageFocusField(image_field="source")
- Add the
ImageFocusAdminMixin
to your model admin
# admin.py
from django.contrib import admin
from imagefocus import ImageFocusAdminMixin
from .models import ImageModel
@admin.register(ImageModel)
class ImageAdmin(ImageFocusAdminMixin, admin.ModelAdmin):
pass
python3 -m pip install django-image-focus
#settings.py
INSTALLED_APPS = [
# ...
'imagefocus',
]