Mongoengine stores FileField and ImageField for GridFS. The easiest way to replicate the functionality of the original File / Image field?
EDIT:
So this is the class that I have at the moment. I can upload files and save them to disk, Mongo has the file path in the database.
I fall for "to_python" because I believe that it needs to create a proxy_class object, but I donβt see how if all I get is the file path (since the value passed to).
import os import datetime from mongoengine.python_support import str_types from django.db.models.fields.files import FieldFile from django.core.files.base import File from django.core.files.storage import default_storage from mongoengine.base import BaseField from mongoengine.connection import get_db, DEFAULT_CONNECTION_NAME from django.utils.encoding import force_text
source share