Search code examples
pythondjangoforeign-keysmodel-validationwagtail

Wagtail/Django: This page could not be created due to validation errors


I have a little side project I'm working on that documents the history of racehorses, using Wagtail, a fairly new Django CMS.

One of my model classes that I'm using for it (Gist of it is here) keeps encountering the above error. I'm fairly sure it's one of the foreign key lines, as none of my other models have the same problem, but as my Django experience is limited I can't seem to determine what in particular is throwing the error.

My question is this. Is there anything from the above code that I'm obviously doing wrong? And further to that, are there any good resources that deal with model validation in particular?


Solution

  • You have 'intro' and 'biography' as required fields (i.e. there is no blank=True flag set on them), but there is no panel for them in content_panels. As a result, these fields will be throwing a "this field cannot be blank" validation error, but there's no place to display it on the form.