[Answer]-Cannot save new object in one to one relationship using django rest framework

1👍

You should call .save() over idSerial first, it will returns eventID updated instance, then you can set number attribute then save it.

 idSerial = EventIdS(event, data=db_data)
 if idSerial.is_valid():

    eventID = idSerial.save()
    eventID.number = event_id
    eventID.save()
👤levi

Leave a comment