views:

389

answers:

2

Hi All

I'm using the GenerickStackedInline which is a subclass of InlineModelAdmin which goes to ModelAdmin. When I override save_model method... it's not being called.

class LocatedItemStackedInline(generic.GenericStackedInline):
    template = "admin/location_app/located_items/stacked.html"
    model = LocatedItem
    extra = 1
    form = MyModelForm
    raw_id_fields = ('location',)

    def save_model(self, request, obj, form, change):
        import ipdb;ipdb.set_trace()
        super(LocatedItemStackedInline, self).save_model(request, obj, form, change)

    def save_form(self, request, form, change):
        import ipdb;ipdb.set_trace()
        super(LocatedItemStackedInline, self).save_form(request, form, change)

So, I'm missing something?

Any clue?

Regards

A: 

http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save%5Fmodel

describes the function you're talking about. My best guess is that you're confused about when and where that will be called. Also, are you sure you're actually working with the latest revision?

Edit: I'd guess that inline ModelAdmin objects may behave differently, given their otherwise special status.

Paul McMillan
Not really cause I need the request object to use some stuff from hidden fields in the form.Still why can't I use that? Is documented. Isn't implemented?
Esteban Feldman
+1  A: 

The problem was that I was overriding the save_model method on the InlineAdmin instead of on the ModelAdmin itself.

Now is being called...

Cheers.

Esteban Feldman