Re: How do I prevent delete from table that has foreign key references
On 01/20/2013 08:12 PM, Subodh Nijsure wrote:
> Hi,
>
> Say I have model that comprises of Books and Authors. Where a book may
> have multiple authors and this has foreignkey in the books table.
>
> Now how do I prevent deletion of an author record while the there is
> record in books table that has pointer an author record (via foreign key).
>
> Do i need to do this via stored procedure/trigger on DB level or is
> there standard procedure to implement this in delete in django?
Any decent database enforces foreign keys automatically.
Hannu
--
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