@@ -803,6 +803,7 @@ def add_view(
803803 update_schema : Type [BaseModel ],
804804 update_internal_schema : Optional [Type [BaseModel ]] = None ,
805805 delete_schema : Optional [Type [BaseModel ]] = None ,
806+ select_schema : Optional [Type [BaseModel ]] = None ,
806807 include_in_models : bool = True ,
807808 allowed_actions : Optional [set [str ]] = None ,
808809 password_transformer : Optional [Any ] = None ,
@@ -819,6 +820,7 @@ def add_view(
819820 update_schema: Pydantic schema for update operations
820821 update_internal_schema: Internal schema for special update cases
821822 delete_schema: Schema for delete operations
823+ select_schema: Optional schema for read operations (excludes fields from queries)
822824 include_in_models: Show in models list in admin UI
823825 allowed_actions: **Set of allowed operations:**
824826 - **"view"**: Allow viewing records
@@ -835,6 +837,7 @@ def add_view(
835837 Notes:
836838 - Forms are auto-generated with field types determined from Pydantic schemas
837839 - Actions controlled by allowed_actions parameter
840+ - Use select_schema to exclude problematic fields (e.g., TSVector) from read operations
838841 - Use password_transformer for models with password fields that need hashing
839842
840843 URL Routes:
@@ -872,6 +875,29 @@ class UserUpdate(BaseModel):
872875 )
873876 ```
874877
878+ Excluding problematic fields (e.g., TSVector):
879+ ```python
880+ class DocumentCreate(BaseModel):
881+ title: str
882+ content: str
883+ # TSVector field excluded from this schema
884+
885+ class DocumentSelect(BaseModel):
886+ id: int
887+ title: str
888+ content: str
889+ created_at: datetime
890+ # search_vector (TSVector) field excluded
891+
892+ admin.add_view(
893+ model=Document,
894+ create_schema=DocumentCreate,
895+ update_schema=DocumentCreate,
896+ select_schema=DocumentSelect, # TSVector field excluded from reads
897+ allowed_actions={"view", "create", "update"}
898+ )
899+ ```
900+
875901 User with password handling:
876902 ```python
877903 from crudadmin.admin_interface.model_view import PasswordTransformer
@@ -1028,6 +1054,7 @@ class Config:
10281054 update_schema = update_schema ,
10291055 update_internal_schema = update_internal_schema ,
10301056 delete_schema = delete_schema ,
1057+ select_schema = select_schema ,
10311058 admin_site = self .admin_site ,
10321059 allowed_actions = allowed_actions ,
10331060 event_integration = self .event_integration ,
0 commit comments