A wagtail module for creating an image field with annotation metadata
Project description
Allows users to combine a Wagtail image with custom annotation data. Annotations are entered on the backend by clicking points on an image, annotation data is then stored with relative x,y coordinates with custom form data.
Requirements
Wagtail >= 1.5
Installing
Install using pypi
pip install wagtailannotatedimage
Using
Extend the BaseAnnotationForm to define what data should be stored with annotations. AnnotationsField stores the annotations data as a Map with id for the annotation being the key.
from django.db import models
from wagtail.wagtailcore.models import Page
from wagtailannotatedimage.edit_handlers import AnnotatedImagePanel
from wagtailannotatedimage.fields import AnnotationsField
from wagtailannotatedimage.forms import BaseAnnotationForm
class AnnotationForm(BaseAnnotationForm):
text = forms.CharField(widget=forms.TextInput)
class TestPage(Page):
image = models.ForeignKey('wagtailimages.Image', blank=True, null=True,
on_delete=models.SET_NULL, related_name="+")
annotations = AnnotationsField(blank=True)
content_panels = Page.content_panels + [
AnnotatedImagePanel(
'image', 'annotations',
annotation_form=AnnotationForm(), heading='Annotated Image'
)
]
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file wagtailannotatedimage-0.0.2.tar.gz
.
File metadata
- Download URL: wagtailannotatedimage-0.0.2.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7830dc5c9cac6fcfbf6039b8c0372a9be47007e3755ea5d3a45ae6df922c274 |
|
MD5 | 3d4854de71b38893a4eb0997b555fd2c |
|
BLAKE2b-256 | 0964357732a39b8448dad4c0387143b61989f8477363b7fbfc1176feb286de41 |