0

I am trying to import ModelWithFileField without sucsess. here https://docs.djangoproject.com/en/1.10/topics/http/file-uploads/ it says to import in the following manner:

from .models import ModelWithFileField

this does not work for me, I get:

ImportError: cannot import name ModelWithFileField

I have upgraded to the latest version of django

I get the same error when trying to do this:

from .forms import ModelFormWithFileField

Anyone out there know how to get these imports working?

karthikr
  • 97,368
  • 26
  • 197
  • 188
bheaps
  • 29
  • 5
  • It is not a django builtin. It is assumed that your forms.py has your custom form which is named `ModelFormWithFileField` – karthikr Nov 03 '16 at 18:28
  • 1
    You may want to follow the example [here](http://stackoverflow.com/a/8542030/2285236) as the example in the docs is not complete. – ayhan Nov 03 '16 at 18:33

1 Answers1

1

No. That is an example of a model that contains a FileField. You need to use your own model.

OlivierM
  • 2,820
  • 24
  • 41
Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895