Skip to content

typecode/django-image-focus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Image Focus

A django field and widgets for setting the focal point of an image

Usage

  1. 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")
  1. 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

Setup

Installation

python3 -m pip install django-image-focus

Settings

#settings.py
INSTALLED_APPS = [
    # ...
    'imagefocus',
]