Hey Brian - I wasn't sure that the fact that it was inline would have
an effect - I see now that it does - sorry for the incomplete first
post.
I just found it odd that what I was doing worked for ``clean`` but not
``save``.
I'll look into Formsets.

Richard - I'm sure I could do it that way - but I'd rather not to ...

The Poll model is generic and I would be putting application specific
logic inside that generic class.
Then again, maybe it's best just to do that and avoid the headache :)

Cheers,

John


On Jul 2, 11:53 am, "Richard Dahl" <[EMAIL PROTECTED]> wrote:
> You may be able to do what you want to by overriding the save() function
> within the model. If you need any information from the form or related
> object you could pass them as kwargs to 
> save.http://www.djangoproject.com/documentation/model-api/
> -richard
>
> On 7/2/08, Brian Rosner <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Jul 2, 2008, at 12:22 PM, John Boxall wrote:
>
> > > class OptionModelForm(forms.ModelForm):
>
> > >       class Meta:
> > >               model = Option
>
> > >       def save(self, commit=True):
> > >               # Will -NEVER- run
> > >               assert False
>
> > >       def clean(self):
> > >               # Will -ALWAYS- run
> > >               assert False
>
> > > ...
>
> > > class OptionInline(admin.TabularInline):
> > >       model = Option
> > >       form = PollModelForm
>
> > > class PollAdmin(admin.ModelAdmin):
> > >       model = Poll
> > >       inlines = [OptionInline]
>
> > Ok, based on the wrongly posted thread on django-developers, you
> > mentioned it was a form on a ModelAdmin /not/ an inline. Right now
> > save is not called on a ModelForm from an inline. I am still not sure
> > if it ever will. It might end up being a documentation fix. Check into
> > how model formsets work. It might help you uncover why this is.
>
> > Brian Rosner
> >http://oebfare.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to