I have a data model:
type Epg struct {
gorm.Model
Uri string `gorm:";not null;unique"`
Prefix string `gorm:"size:64;not null;default:''"`
Etag string
Updated time.Time
Status bool `gorm:"default:true"`
}
I publish this data model in menu:
EpgResource := Admin.AddResource(&models.Epg{}, &admin.Config{Menu: []string{"Content"}})
Now I can view and edit data via QoR Admin panel. But I want to make values Etag
, Updated
, Status
to be readonly because they are updated by the system.
If I try to make this fields readonly according documentation:
EpgResource.Meta(&admin.Meta{Name: "Etag", Type: "Readonly"})
I got an error. Is it possible to make some fields in data model visible but readonly? How to do that?
Error log trace.
2017/04/25 01:16:04 Finish [GET] /admin/epgs Took 19.59ms /usr/local/go/src/text/template/exec.go:433 /usr/local/go/src/text/template/exec.go:536 /usr/local/go/src/text/template/exec.go:668 /usr/local/go/src/reflect/value.go:302 /usr/local/go/src/reflect/value.go:434 /usr/local/go/src/runtime/asm_amd64.s:515 /home/rns/golang/src/github.com/qor/admin/func_map.go:1051 /home/rns/golang/src/github.com/qor/admin/func_map.go:220 /home/rns/golang/src/github.com/qor/admin/func_map.go:236 /home/rns/golang/src/github.com/qor/admin/func_map.go:393 got error when render form template for Etag(Readonly): haven't found form template for meta Etag