1

Wagtail

My model code:

class HomePage(Page):

    images = models.ImagesField(max_count = 20)  // How to do it right?
   
    content_panels = Page.content_panels + [
        ImagesChooserPanel('images'),
    ]

How it should look

Please help!

LOVE USA
  • 51
  • 6
  • This is covered in the tutorial: https://docs.wagtail.io/en/stable/getting_started/tutorial.html#images – gasman Sep 27 '20 at 14:54

2 Answers2

1

(sadly)You can't such thing as

images = models.ImagesField(max_count = 20)  

but there are multiple ways you can associate multiple images to the same model as

  1. using image1 = models.ImagesField(upload_tp='somewhere') image2 = models.ImagesField(upload_tp='somewhere')
  2. second associate model to a different model using a foreign key and use the first way
Dakshesh Jain
  • 321
  • 1
  • 8
1

Solved by streamfield

images =  StreamField([
        ('image', ImageChooserBlock()),
    ])
LOVE USA
  • 51
  • 6