Here is my problem :
Class Map(meta.Model):
name = meta.CharField(maxlength=255)
Class City(meta.Model):
map = meta.ForeignKey(Map, null = True, blank = True)
name = meta.CharField(maxlength=255)
...
Now create a Map object : OK
Now create a City with no Map related : OK
Now update the City to refer the Map : OK
Now delte the Map : Problem
If you wan't to delete the Map, all related Cities will be delete also.
It is great when a relation can not be null but you may want to keep
Cities' informations even if you delete a Map.
What can I do ??
Regards,
Laurent
PS : I use postgresql as database server.
A simple example :
Class Team(meta.Model):
....
Class Family(meta.Model):
....
Class Person(meta.Model):
family = meta.ForeignKey(Family, null = False)
team = meta.ForeignKey(Team, null = True, blank = True)
I think that :
- if I delete a familly object, all related persons must be delete
because of the null = false statement,
- but if I delete a team, all Persons should stay because they may be
belonging to a family and that null = True.
Am I misunderstanding something ??