내가 당신을 이해한다면 다음과 같은 것이 작동합니다.
class MyModelForm(forms.ModelForm):
class Meta:
model = MyModel
def clean(self):
content_type = self.cleaned_data.get('content_type')
object_id = self.cleaned_data.get('object_id')
if content_type and object_id:
obj = content_type.get_object_for_this_type(pk=object_id)
# Check whatever on the object here, and if there's a problem:
# raise forms.ValidationError('Something is not right')
return self.cleaned_data
출처
https://stackoverflow.com/questions/7415087