On Jan 6, 12:47 am, drakkan <drakkan1...@gmail.com> wrote: > On 6 Gen, 00:41, drakkan <drakkan1...@gmail.com> wrote: > > Suppose I want to delete an user. This user is in table1 and so in > databaseview too. Django default is to do adeletecascade so it tries > to remove the user from table1, databaseview and auth_user: it fails > when try to remove user from databaseview. > > A possible solution would be : > > - before issue user.delete(), issue something like > table1.objects.filter(user=u).delete() (this way user reference > disappear from databaseview too) and then u.delete() > I've just had this problem and fixed it simply by adding a rule in the database: "create rule myrule as on delete to mytable do instead nothing;" Django still attempts to delete the record but the db (Postgres) just ignores it. http://www.postgresql.org/docs/8.1/static/rules-update.html Hence the error message: HINT: You need an unconditional ON DELETE DO INSTEAD rule. HTH Will --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---