views:

34

answers:

1

Hi All,

I am working on a Django application on Google app engine (using app engine patch). In my project I have to customize the way the delete functionality works in the admin panel. I have defined my own functions for all the models that I have created and its working fine.

Now the issue is to customize the delete functionality for the User model.

Can someone please let me know how can I customize the way user deletion is done by default ? What I need is, when some user is deleted, all the other records where User is defined as a ReferenceProperty should Reference to an anonymous user instead of getting a ReferenceProperty not found error message.

Please suggest if there is some method which needs to be customized without making any changes to how the authentication system is working.

Thanks in advance.

+1  A: 

An easy (not sure if the best) way would be to connect to the pre_delete signal sent by User class and use it to update the other tables. You can write a function that connects to this signal and updates other tables appropriately.

Manoj Govindan
Thanks a lot Manoj. Can you please let me know where should this be implemented?
anand
I usually put my signal related code (functions, connecting to signals) in my `models.py`. The documentation also recommends this: http://docs.djangoproject.com/en/dev/topics/signals/#connecting-receiver-functions Also it would be a good idea to vote up and accept the answer if it helped you ;)
Manoj Govindan
offcourse I will do that. Just implementing it.
anand