admin: new route to fill URLIds if they are not defined
This commit is contained in:
parent
44ceeb17d9
commit
5fdb35eabc
4 changed files with 56 additions and 0 deletions
|
|
@ -60,6 +60,14 @@ func CreateTheme(name string, url_id string, authors string, intro string) (Them
|
|||
}
|
||||
}
|
||||
|
||||
func (t *Theme) FixURLId() bool {
|
||||
if t.URLId == "" {
|
||||
t.URLId = ToURLid(t.Name)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (t Theme) Update() (int64, error) {
|
||||
if res, err := DBExec("UPDATE themes SET name = ?, url_id = ?, authors = ?, intro = ? WHERE id_theme = ?", t.Name, t.URLId, t.Authors, t.Intro, t.Id); err != nil {
|
||||
return 0, err
|
||||
|
|
|
|||
Reference in a new issue