0

This is the Gallery Page models, we've added 142 image so far, and we're able to add more images in other pages, but on this one, even if I delete an image and try to add another one I got an 400 Bad Request on publishing and Error while sending preview data. on previewing

class Gallery(Page):
    
    content_panels = Page.content_panels + [
        InlinePanel('media', label=_('Gallery Media'))
    ]


class GalleryMedia(ClusterableModel, Orderable):
    category = ParentalManyToManyField("gallery.GalleryCategory", blank=True)
    gallery = ParentalKey(
        "gallery.Gallery", on_delete=models.CASCADE, related_name="media", null=True
    )
    image = models.ForeignKey(
        "wagtailimages.Image", on_delete=models.CASCADE, related_name="+", null=True, blank=True, 
        help_text="The recommended sizes and dimensions for the images are:  350*200 / Aspect Ratio 7 : 4 - 350*700 / Aspect Ratio 1 : 2 - 350*500 / Aspect Ratio 7 : 10"
    )
    video_url = models.URLField(blank=True)
    video = models.ForeignKey(
        "wagtailvideos.Video",
        related_name="+",
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
    )
    show_large = models.BooleanField(default=False)
    show_on_homepage = models.BooleanField(default=False, verbose_name="Show on HomePage")

    panels = [
        ImageChooserPanel("image"),
        FieldPanel("video_url"),
        VideoChooserPanel("video"),
        FieldPanel("show_large"),
        FieldPanel("show_on_homepage"),
        MultiFieldPanel([FieldPanel("category", widget=CheckboxSelectMultiple),]),
    ]


class GalleryCategory(models.Model):
    name = models.CharField(max_length=50)

    panels = [
        FieldPanel("name"),
    ]
Miriam Arbaji
  • 319
  • 1
  • 3
  • 17
  • it is possible you are hitting the https://docs.djangoproject.com/en/3.2/ref/settings/#data-upload-max-number-fields limit. A traceback would help – zerolab May 06 '21 at 08:45
  • YES! it was the limit, I discovered it a few hours ago, please put it in a separate comment so I can mark it as an answer – Miriam Arbaji May 06 '21 at 09:56

1 Answers1

1

It is possible you are hitting the https://docs.djangoproject.com/en/3.2/ref/settings/#data-upload-max-number-fields. Tweaking that and related settings should work

zerolab
  • 826
  • 8
  • 17