Browse Source

Document admin_form_fields

Karl Hobley 9 years ago
parent
commit
afda401956
1 changed files with 6 additions and 1 deletions
  1. 6 1
      docs/topics/images/advanced_topics.rst

+ 6 - 1
docs/topics/images/advanced_topics.rst

@@ -28,7 +28,7 @@ Here's an example:
     from django.db.models.signals import pre_delete
     from django.dispatch import receiver
     
-    from wagtail.wagtailimages.models import AbstractImage, AbstractRendition
+    from wagtail.wagtailimages.models import Image, AbstractImage, AbstractRendition
 
 
     class CustomImage(AbstractImage):
@@ -37,6 +37,11 @@ Here's an example:
         # eg. To add a caption field:
         # caption = models.CharField(max_length=255)
 
+        admin_form_fields = Image.admin_form_fields + (
+            # Then add the field names here to make them appear in the form:
+            # 'caption',
+        )
+
 
     class CustomRendition(AbstractRendition):
         image = models.ForeignKey(CustomImage, related_name='renditions')