Skip to content
This repository was archived by the owner on Jan 10, 2022. It is now read-only.

Commit ee1b606

Browse files
some api fixes
1 parent 40adefb commit ee1b606

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

core/admin_page.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ type AdminPage struct {
174174
NoPermissionToAddNew bool
175175
NoPermissionToEdit bool
176176
PermissionName CustomPermission
177-
PreloadData func(afo IAdminFilterObjects) `json:"-"`
177+
EnhanceQuerySet func(afo IAdminFilterObjects) `json:"-"`
178178
CustomizeQuerySet func(adminContext IAdminContext, afo IAdminFilterObjects, requestParams *AdminRequestParams) `json:"-"`
179179
}
180180

core/form_field_options.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,4 +196,8 @@ func init() {
196196
WidgetType: "textarea",
197197
ReadOnly: true,
198198
})
199+
UadminFormCongirurableOptionInstance.AddFieldFormOptions(&FieldFormOptions{
200+
Name: "EmailFieldOptions",
201+
WidgetType: "email",
202+
})
199203
}

core/form_widget.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ func GetWidgetByWidgetType(widgetType string, fieldOptions IFieldFormOptions) IW
129129
widget = &PasswordWidget{}
130130
case "dynamic":
131131
widget = &DynamicWidget{}
132+
case "email":
133+
widget = &EmailWidget{}
132134
case "foreignkey":
133135
widget = &ForeignKeyWidget{}
134136
if fieldOptions != nil && fieldOptions.GetIsAutocomplete() {

core/gorm_persistence_storage.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ func NewGormAdminPage(parentPage *AdminPage, genModelI func() (interface{}, inte
5252
UadminDatabase: uadminDatabase,
5353
GenerateModelI: genModelI,
5454
}
55-
if adminPage.PreloadData != nil {
56-
adminPage.PreloadData(ret)
55+
if adminPage.EnhanceQuerySet != nil {
56+
adminPage.EnhanceQuerySet(ret)
5757
}
5858
if adminRequestParams != nil && adminRequestParams.RequestURL != "" {
5959
url1, _ := url.Parse(adminRequestParams.RequestURL)

0 commit comments

Comments
 (0)