Check out example codes for "how to prevent data deleted from the database wehen the user gets deleted using django models". It will help you in understanding the concepts better.

Code Example 1

class Employee(models.Model):
    name = models.CharField(name, unique=True)

class Project(models.Model):
    name = models.CharField(name, unique=True)
    employees = models.ForeignKey(Employee, on_delete=models.PROTECT)

Learn ReactJs, React Native from akashmittal.com