django-cast
django-cast copied to clipboard
Page has no page_ptr During Preview
From sentry:
self.related_val = self.source_field.get_foreign_related_value(instance)
if None in self.related_val:
raise ValueError(
'"%r" needs to have a value for field "%s" before '
"this many-to-many relationship can be used."
% (instance, self.pk_field_names[self.source_field_name])
)
# Even if this relation is not to pk, we require still pk value.
Hmm, it's not easy to fix. Maybe wait for some Wagtail minor versions fixing this?
Ok, it is still broken.. maybe just catch and ignore it?
Still broken:
"<Post: Weeknotes 2024-07-08>" needs to have a value for field "page_ptr" before this many-to-many relationship can be used.
except ValueError:
# will be raised on wagtail preview because page_ptr is not set
pass
return super().serve_preview(request, mode_name)