I have a form in Vue which takes in data that is spread into multiple models when sent to django .
Rest JSON is
data = {
people:{
name: "MyName",
age: 34
},
classes:{
name:"Valgris",
tag:3492,
comment:"gob gdjoisu is tsutsi"
}
}
-THE MODELS FIELD IN DJANGO ARE
class Classes(models.Model):
name = models.CharField(_ max_length=50)
age = models.IntegerField()
class People(models.Model):
name = models.CharField(_ max_length=50)
tag = models.IntegerField()
comment= models.TextField()
--- I tried tried using perform_create in my view, and also use create in serializer but I am unable to do it. request.data does not seem to like me popping out data and saving the result. It just doesn't work well.
Is there a way out. or do I have to send two request to create People and Classes model