1👍
Change
class File(models.Model):
user = models.ForeignKey(User)
src = models.FileField(upload_to="src")
to:
class UserFile(models.Model): # for example
user = models.ForeignKey(User)
src = models.FileField(upload_to="src")
and then create it like this:
files = UserFile.objects.create(src=djangofile, user=user)
from django.core.files import File
is conflicting with from yourapp.models import File
One example on using FileFields
.
Source:stackexchange.com