aminalaee/fastapi-storages

Cannot open admin panel

Closed this issue · 4 comments

So, I am using fastapi-storages and sqladmin together. I was able to create model with field, but when I open admin panel I get the error: sqladmin.exceptions.NoConverterFound: Could not find field converter for column image (<class 'fastapi_storages.integrations.sqlalchemy.FileType'>).

Here is my code:

class Image(Base):
    __tablename__ = "core_image"

    id = Column(Integer, primary_key=True, index=True)

    contenttype_id = Column(ForeignKey("base_contenttype.id", ondelete="CASCADE"))
    object_id = Column(Integer)

    contenttype = relationship("ContentType")
    image = Column(FileType(storage=FileSystemStorage(path="src/media")))

class ImageAdmin(ModelView, model=Image):
    column_list = [Image.contenttype, Image.object_id, Image.image]

I get the error in DETAILED view, LIST view is loading just fine.

P. S. Folder media exists.

Can you post what versions are you using?
I assume they are not the latest

sqladmin = "^0.12.0"
fastapi-storages = "^0.1.0"
fastapi = = "^0.97.0"

Windows10, Python 3.10

Yeah I think you should upgrade to sqladmin 0.13.0 for this.

Yep that solved it. THanks!