Re: How do I prevent delete from table that has foreign key references
On Sun, Jan 20, 2013 at 2:21 PM, Pankaj Singh <ps.jinx@gmail.com> wrote:
> If I your problem understood correctly, then `on_delete` option
> available in ForeingKey field[1] should be helpful in this case.
note that this doesn't use database-level restrictions, this behaviour
is emulated at the ORM level. IOW: any deletion done via the ORM will
respect the on_delete option, but anything done with direct SQL won't.
you can (maybe should) add a 'initial sql' [1] parameter to set any
DB-level restriction like this.
[1]: https://docs.djangoproject.com/en/dev/howto/initial-data/#initial-sql
--
Javier
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home