I have the following models
class Database(models.Model):
user = models.ForeignKey(User)
name = models.CharField(max_length=100)
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
class DatabaseUser(models.Model):
user = models.ForeignKey(User)
name = models.CharField(max_length=100)
password = models.CharField(max_length=100)
database = models.ManyToManyField(Database)
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
One DatabaseUser can have many Databases under it's control.
The issue I have if I go to delete a Database it wants to Delete the DatabaseUser also.. Is there a way to stop this from happening easily?