Can anyone confirm that passing in a form with Meta.widgets set to
modelformset_factory() does in fact work?

I've tried stripping my code down to the basics and still get the same
exception. Debugging Django code doesn't help me because it fails
during a lamda function that I don't quite understand.

If anyone else has this problem I'll go ahead and submit a bug report.

On Jul 28, 12:50 pm, Jason <goodri...@gmail.com> wrote:
> Traceback:
> File "C:\Python25\lib\site-packages\django\core\handlers\base.py" in
> get_response
>   100.                     response = callback(request,
> *callback_args, **callback_kwargs)
> File "C:\Documents and Settings\goodrich\PycharmProjects\CCC\Aggregator
> \newsmail\views.py" in manage_articles
>   174.                                           form = ArticleForm)
> File "C:\Python25\lib\site-packages\django\forms\models.py" in
> modelformset_factory
>   669.
> formfield_callback=formfield_callback)
> File "C:\Python25\lib\site-packages\django\forms\models.py" in
> modelform_factory
>   407.     return ModelFormMetaclass(class_name, (form,),
> form_class_attrs)
> File "C:\Python25\lib\site-packages\django\forms\models.py" in __new__
>   220.                                       opts.exclude,
> opts.widgets, formfield_callback)
> File "C:\Python25\lib\site-packages\django\forms\models.py" in
> fields_for_model
>   178.         formfield = formfield_callback(f, **kwargs)
>
> Exception Type: TypeError at /newsmail/manage/
> Exception Value: <lambda>() got an unexpected keyword argument
> 'widget'
>
> On Jul 28, 12:00 pm, Daniel Roseman <dan...@roseman.org.uk> wrote:
>
> > On Jul 28, 7:08 pm, Jason <goodri...@gmail.com> wrote:
>
> > > For example:
>
> > > class ArticleForm(ModelForm):
> > >     class Meta:
> > >         model = Article
> > >         widgets = {
> > >              'pub_date': SplitSelectDateTimeWidget(),
> > >              'expire_date': CalendarWidget(attrs={'class':'date-
> > > pick'})
> > >         }
>
> > > And in a view function:
> > > ...
> > >     ArticleFormSet = modelformset_factory(Article,
> > >                                           form = ArticleForm,
> > >                                           extra=0)
> > > ...
>
> > > Removing 'widgets' from the Meta in ArticleForm fixes the error.
>
> > > The new widgets convention here is really handy. I don't want to lose
> > > it!
>
> > > Any tips?
>
> > How does it fail? What error do you get? If there's a traceback,
> > please post it here.
> > --
> > DR.
>
>

-- 
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