@@ -384,7 +384,7 @@ class PageAdmin(PageSchemaAdmin, RouterAdmin):
384384 def __init__ (self , app : "AdminApp" ):
385385 RouterAdmin .__init__ (self , app )
386386 if self .page_path is None :
387- self .page_path = f"/{ self .__class__ .__module__ } / { self . __class__ . __name__ } "
387+ self .page_path = f"/{ self .__class__ .__name__ } "
388388 PageSchemaAdmin .__init__ (self , app )
389389
390390 async def page_permission_depend (self , request : Request ) -> bool :
@@ -636,10 +636,14 @@ def __init__(self, app: "AdminApp"):
636636 self .schema_model = self .parser .get_table_model_schema (self .model )
637637 assert self .schema_model , "schema_model is None"
638638 list_display_insfield = self .parser .filter_insfield (self .list_display , save_class = (Label ,))
639- self .list_filter = self .list_filter and self .list_filter .copy () or list_display_insfield or []
639+ list_display_insfield = list_display_insfield or list (self .parser .get_table_model_insfields (self .model ).values ())
640+ # Initialize the filterable fields
641+ self .list_filter = self .list_filter and self .list_filter .copy () or list_display_insfield
640642 self .list_filter .extend ([field for field in self .search_fields if field not in self .list_filter ])
643+ # Initialize the selected fields
644+ self .fields = self .fields and self .fields .copy () or []
645+ self .fields .extend ([field for field in list_display_insfield if field not in self .fields ])
641646 SqlalchemyCrud .__init__ (self , self .model , self .engine )
642- self .fields .extend (list_display_insfield )
643647 BaseActionAdmin .__init__ (self , app )
644648
645649 @property
0 commit comments