[Answered ]-How to create one to one field with Django for existing table?

1👍

here is an answer to your question: https://stackoverflow.com/a/63323183/10602634

django signals can be used to create, update or delete on change of an object.

in your case:

from django.dispatch.dispatcher import receiver

class ProductDetails(models.Model):
    product =  models.OneToOneField(Product, on_delete= models.CASCADE)
    '''rest'''

wrap a function using receiver

@receiver(post_save, sender=Product)
def add_details(sender, instance, created, **kwargs):
    if created:
        ProductDetails.objects.create(product=instance)
        return ProductDetails

django documnetation on receiver covers the topic https://docs.djangoproject.com/en/3.2/topics/signals/#receiver-functions

Leave a comment