from path import path from django.db import models class PathFilePathField(models.FilePathField): """ A FilePathField that deals with path.py objects. """ __metaclass__ = models.SubfieldBase def get_prep_value(self, value): return str(value) def to_python(self, value): return path(value)