ForeignKey error

following are the codes
in model.py
class Channel(models.Model):

# id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=100, default='')
language = models.ForeignKey(Language, on_delete=models.CASCADE,default='en')
parent = models.ForeignKey("self", related_name='children',default=0,blank=True,null=True,on_delete=models.CASCADE)    
image = models.ForeignKey(Image, related_name='channel_image', on_delete=models.CASCADE,default=0)
display_index = models.IntegerField(default=0)
release = models.BooleanField(default=False)

created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)

def _str_(self) -> str:
    return self.name

in Scehma.py
class ChannelSchema(ModelSchema):
class Config:
model = Channel
model_fields = [“id”,“name”, “language”, “parent”,“image”,“display_index”,“release”,“created_at”,“updated_at”]

in api.py
@api.post(“/channels/”)
def channels(request,data:ChannelSchema):

qs = Channel.objects.create(**data.dict())
return {"post channels":"completed"+qs.name}

when I post data to /channels
I get first error or second error.

first error
ValueError: Cannot assign “0”: “Channel.language” must be a “Language” instance.

POST obj
{
“id”: 0,
“name”: “”,
“language_id”: 0,
“parent_id”: 0,
“image_id”: 0,
“display_index”: 0,
“release”: false,
“created_at”: “2022-03-25T02:57:43.965Z”,
“updated_at”: “2022-03-25T02:57:43.965Z”
}

Second error if I change the attrbute from “language_id” to “language”
{
“detail”: [
{
“loc”: [
“body”,
“data”,
“language_id”
],
“msg”: “field required”,
“type”: “value_error.missing”
}
]
}

#data.dict().keys
# major_cd =  Major.objects.get(major_cd=int(major_cd)),

Welcome to the Django forum!

First, a side note. When posting code here, enclose the code between lines of three backtick - ` characters. That means you will have a line of ```, then your code, then another line of ```. (When posting code from multiple files, it’s generally most useful to do this for each file individually.) This forces the forum software to keep your code properly formatted. This is also the recommended process when posting templates, error messages, and other pre-formatted text.

However, this appears to be an issue with a third-party library, not Django. What libraries are involved here? (Django has no facilities for using files named “schema.py” or “api.py” - they would be part of an add-on.)

If this is an issue you are having with the Django REST Framework, see Home - Django REST framework. If this is using some other third-party library, you may want to search for a support forum for that library.