Doc: Refine loader description

This commit is contained in:
winkidney
2020-05-08 13:01:27 +08:00
parent 4314ee6b27
commit f15f8209d8

View File

@@ -3,10 +3,10 @@
New plugin system is under development and a naive version has been released. New plugin system is under development and a naive version has been released.
A `PinryPlugin` is a python class or object which is callable. A `PinryPlugin` is a python class or object which is callable.
The plugin loader will call the plugin argument only once and use the plugin The plugin loader will call the `Plugin` target only once and use the plugin
instance after specified events triggered just like the way django-middleware works. instance after specified events triggered just like the way django-middleware works.
You could create a plugin as python-package with content: You could create a plugin as python-package with content below:
``` ```
from core.models import Image from core.models import Image
@@ -16,7 +16,7 @@ from django_images.models import Thumbnail
class Plugin: class Plugin:
def __init__(self): def __init__(self):
# do something you want, just be called only # do something you want, just be called only once
pass pass
def process_image_pre_creation(self, django_settings, image_instance: Image): def process_image_pre_creation(self, django_settings, image_instance: Image):