Re: How to make delete() more clever?

2006-08-13 Thread 一首诗
First I should thank Ivan for your help. But I think Malcolm figured out what I really want. Maybe django should catch Exception when calling a model's save / delete method. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: How to make delete() more clever?

2006-08-12 Thread Malcolm Tredinnick
On Sat, 2006-08-12 at 21:56 +0400, Ivan Sagalaev wrote: > 一首诗 wrote: > > But how can I give some information to user that the delete is not > > allowed? > > By the codes above, the user just see that the delete was done! > > This is exactly the case for using exceptions. Define your own

Re: How to make delete() more clever?

2006-08-12 Thread Ivan Sagalaev
一首诗 wrote: > But how can I give some information to user that the delete is not > allowed? > By the codes above, the user just see that the delete was done! This is exactly the case for using exceptions. Define your own exception and raise it where user shouldn't delete an object. Then define a

How to make delete() more clever?

2006-08-12 Thread 一首诗
I want to override delete() === from django.db import models class Person(models.Model): first_name = models.CharField(maxlength=20) last_name = models.CharField(maxlength=20) def delete(self): if ( A ): super(Person,