On 8/18/06, medhat <[EMAIL PROTECTED]> wrote:
> First, I am using sqlite... and I checked the manage.py sqlall and it
> had no "on delete cascade" at all. So, is this done programmatically in
> python to simulate the same effect?

Yes, as James mentioned, it is done programmatically; Django simulates
the effects of "on delete cascade" when you delete an object. I
mentioned the SQL because you could alter your database tables to do
this explicitly, if nothing else is working.

> And I had the ticket model with two
> foreign keys to the user record (who reported it, and who fixed it) the
> first one is required, while the second one is not.

I'd say it's very likely that that is related to this issue... I'd
have to read through the code to be sure, but this might be causing
Django to not delete the user records when the tickets are deleted.

> When I delete the
> user in the admin side it tells me that it will also delete all the
> tickes that are created by that user, but not the ones fixed by the
> user. So here I have a few questions:
>
> 1. Why did it do that (not that I am complaining, I just want to
> understand) does it have to do with one field being required and the
> other not?
> 2. Is this behavior documented anywhere? It feels a bit of magic to me
> when it is hard to predict how the software will behave!

I'm sure the core developers would be much more qualified to answer
these questions than I am :) -- especially if it is related to having
two ForeignKey fields to the same model.

> 3. I am still looking for an answer to my original question at the
> beginning of this discussion. What if I don't want to delete the
> tickets but assign them to another user?

Was that the original question?

All I saw was:

On 8/17/06, medhat <[EMAIL PROTECTED]> wrote:
> 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?

If you want to do something different, like assign the tickets to
another user, you will have to write a custom view (and possibly a
custom manipulator) to do this. In that case, you would not want to
delete users using the built-in admin interface at all, but use your
custom view instead.

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