Hey Marc - that's what I thought!

But in NFA - it seems the save method isn't called!

For instance:

class ModelUserAdmin(admin.ModelAdmin):

        form = ModelUserForm

...

class ModelUserForm(forms.ModelForm):

        def clean(self):
                # This method will successfully be called from the add_view or
change_view
                # of NFA
                print 'ModelUserForm >>> clean()'
                super(ModelUserForm, self).clean()

        def save(self, commit=True):
                # This method -WILL NOT- be called from the add_view or 
change_view
                # of NFA - but I would like it to be!
                print 'ModelUserForm >>> save()'
                super(ModelUserForm, self).save(commit)

On Jul 2, 3:50 am, Marc Garcia <[EMAIL PROTECTED]> wrote:
> Sure,
>
> just remember to return
>
> super(YourModelForm, self).save(commit)
>
> in it.
>
> On Jul 2, 9:10 am, John Boxall <[EMAIL PROTECTED]> wrote:
>
> > Hi everyone!
>
> > I'm just trying out newforms admin - it's fantastic. I can't wait
> > until this makes it's way into trunk -
>
> > A question -
> > I'd like to add custom behavior when a object is saved in the admin
> > console.
>
> > I'm following this example of how to add custom behaviour to validate
> > an 
> > object:http://code.djangoproject.com/wiki/NewformsHOWTO#Q:HowdoIaddcustomval...
>
> > I would expect to be able to add a save() method to my ModelForm and
> > have it be called when I hit save... how ever this does not seem to be
> > the case!
>
> > Has anyone had any luck overriding the save method of a model form in
> > NFA?
>
> > Cheers,
>
> > John
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to