added CachedForeignKey for gallery