For the reference of future generations, the following seems to work:

class MyAdminForm(forms.ModelForm):
        def __init__(self, *args, **kwargs):
                super(MyAdminForm, self).__init__(*args, **kwargs)
                self.fields['some_fpath_field'].choices = [('','----------'),] +
self.fields['some_fpath_field'].choices


class MyInline(models.TabularInline):
        form = MyAdminForm


On Jun 23, 10:43 am, Nan <ringe...@gmail.com> wrote:
> This is driving me batty...
>
> Because there's no blank option in the form field for a FilePathField
> with blank=False, then if you:
>
> - Have an Admin Inline with a FilePathField and another required field
> - Have extra (i.e. intentionally blank) inlines in your form
>
> You will get an error upon saving because the FilePathField is not
> blank but the other fields are, and so the formset thinks you're
> trying to save those objects but have left the other required fields
> blank.
>
> Is there *any* workaround for this?
>
> Thanks,
> -Nan

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