class FileField(models.FileField): def __init__(self, *args, **kwargs): assert not "upload_to" in kwargs kwargs["upload_to"] = self.get_upload_path super(FileField, self).__init__(*args, **kwargs) def get_upload_path(self, instance, filename): return os.path.join("_".join([ instance._meta.app_label, instance._meta.object_name, self.name]), filename).lower()