Hi, as far as i'm aware, the delete method on models only get's called
if you delete an instance of that modal directly. So if you delete a
modal who has many children, the child delete methods don't get
called. So I suppose the next question would be are you deleting
TrackCategory's directly or are you deleting something that contains
TrackCategory's?




On Aug 13, 4:02 pm, Alessandro Pasotti <apaso...@gmail.com> wrote:
> Hi,
>
> I have a m2m like this:
>
> class TrackCategory(Model):
>   ....
>
> class Track(Model):
>   category = models.ManyToManyField(TrackCategory)
>
> I want to avoid that users delete a TrackCategory which contains Tracks, the
> best would be to allow deletion of the TrackCategory if and only the linked
> Tracks belongs to more than one category.
>
> In other words, I want to avoid to have uncategorized Tracks.
>
> I tried to override TrackCategory.delete() to do some checks before calling
> the parent delete() but the method seems not to be called when deleting from
> the change_list in admin.
>
> Any idea?
>
> PS: I'm using Django 1.2
>
> --
> Alessandro Pasotti
> w3:  www.itopen.it

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.

Reply via email to