On 8/17/06, medhat <[EMAIL PROTECTED]> wrote:
> A ticket system where users can create tickets. A ticket object has a
> foreign key field to a user object. I would like to delete all the
> tickets created by a user if that user is deleted. Is there a way to do
> this *without* changing the user model?

I would have thought that this would have been automatic -- normally
Django does a good job of telling me, when I delete an object, about
any other objects related to it which will also be deleted.

But, if you just want to be certain that all of the tickets are
deleted when the user is deleted, you could alter the ticket table in
your database. Just make sure that the user_id column explicitly says
"on delete cascade", and the database will take care of deleting
tickets automatically.

Regards,
Ian Clelland
<[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to