|
2 | 2 |
|
3 | 3 | from fastapi_amis_admin.admin import AdminApp, ModelAdmin, PageSchemaAdmin |
4 | 4 | from fastapi_amis_admin.amis.components import PageSchema |
5 | | -from fastapi_amis_admin.crud.utils import schema_create_by_schema |
| 5 | +from fastapi_amis_admin.utils.pydantic import create_model_by_model |
6 | 6 | from fastapi_amis_admin.utils.translation import i18n as _ |
7 | 7 | from starlette.requests import Request |
8 | 8 |
|
@@ -33,16 +33,16 @@ def __init__(self, app: "AdminApp"): |
33 | 33 | self.auth = self.auth or self.site.auth |
34 | 34 | AuthRouter.__init__(self) |
35 | 35 | self.UserAdmin.model = self.UserAdmin.model or self.auth.user_model |
36 | | - self.UserLoginFormAdmin.schema = self.UserLoginFormAdmin.schema or schema_create_by_schema( |
| 36 | + self.UserLoginFormAdmin.schema = self.UserLoginFormAdmin.schema or create_model_by_model( |
37 | 37 | self.auth.user_model, "UserLoginIn", include={"username", "password"} |
38 | 38 | ) |
39 | 39 | self.UserLoginFormAdmin.schema_submit_out = self.UserLoginFormAdmin.schema_submit_out or self.schema_user_login_out |
40 | | - self.UserRegFormAdmin.schema = self.UserRegFormAdmin.schema or schema_create_by_schema( |
| 40 | + self.UserRegFormAdmin.schema = self.UserRegFormAdmin.schema or create_model_by_model( |
41 | 41 | self.auth.user_model, "UserRegIn", include={"username", "password", "email"} |
42 | 42 | ) |
43 | 43 | self.UserRegFormAdmin.schema_submit_out = self.UserRegFormAdmin.schema_submit_out or self.schema_user_login_out |
44 | 44 | self.UserInfoFormAdmin.user_model = self.auth.user_model |
45 | | - self.UserInfoFormAdmin.schema = self.UserInfoFormAdmin.schema or schema_create_by_schema( |
| 45 | + self.UserInfoFormAdmin.schema = self.UserInfoFormAdmin.schema or create_model_by_model( |
46 | 46 | self.auth.user_model, |
47 | 47 | "UserInfoForm", |
48 | 48 | include={"nickname", "password", "avatar", "email"}, |
|
0 commit comments