突然我们无法在 Wagtail 的特定页面中添加更多图像,出现 400 错误请求错误
Suddenly We're not able to add more images in specific page in Wagtail with 400 Bad Request Error
这是图库页面模型,到目前为止我们已经添加了 142 张图片,我们可以在其他页面中添加更多图片,但是在这个页面上,即使我删除了一张图片并尝试添加另一张图片我在发布时获得 400 Bad Request
,在预览时获得 Error while sending preview data.
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"),
]
您可能正在点击 https://docs.djangoproject.com/en/3.2/ref/settings/#data-upload-max-number-fields。调整它和相关设置应该工作
这是图库页面模型,到目前为止我们已经添加了 142 张图片,我们可以在其他页面中添加更多图片,但是在这个页面上,即使我删除了一张图片并尝试添加另一张图片我在发布时获得 400 Bad Request
,在预览时获得 Error while sending preview data.
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"),
]
您可能正在点击 https://docs.djangoproject.com/en/3.2/ref/settings/#data-upload-max-number-fields。调整它和相关设置应该工作