0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-29 17:36:49 +01:00

Skip extract_references on ChooserBlock if model is not a real model

This commit is contained in:
Matt Westcott 2023-09-04 20:37:09 +01:00 committed by Matt Westcott
parent 2dcfdedc37
commit 98784fa153

View File

@ -2,6 +2,7 @@ import datetime
from decimal import Decimal
from django import forms
from django.db.models import Model
from django.db.models.fields import BLANK_CHOICE_DASH
from django.forms.fields import CallableChoiceIterator
from django.utils.dateparse import parse_date, parse_datetime, parse_time
@ -831,7 +832,7 @@ class ChooserBlock(FieldBlock):
return super().clean(value)
def extract_references(self, value):
if value is not None:
if value is not None and issubclass(self.model_class, Model):
yield self.model_class, str(value.pk), "", ""
class Meta: