本文整理匯總了Golang中github.com/beego/wetalk/modules/post.PostForm.SetFromPost方法的典型用法代碼示例。如果您正苦於以下問題:Golang PostForm.SetFromPost方法的具體用法?Golang PostForm.SetFromPost怎麽用?Golang PostForm.SetFromPost使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/beego/wetalk/modules/post.PostForm
的用法示例。
在下文中一共展示了PostForm.SetFromPost方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: EditSubmit
func (this *PostRouter) EditSubmit() {
this.TplName = "post/edit.html"
if this.CheckActiveRedirect() {
return
}
var postMd models.Post
if this.loadPost(&postMd, &this.User) {
return
}
form := post.PostForm{}
form.SetFromPost(&postMd)
post.ListCategories(&form.Categories)
post.ListTopics(&form.Topics)
if !this.ValidFormSets(&form) {
return
}
if err := form.UpdatePost(&postMd, &this.User); err == nil {
this.JsStorage("deleteKey", "post/edit")
this.Redirect(postMd.Link(), 302)
}
}
示例2: Edit
func (this *PostRouter) Edit() {
this.TplName = "post/edit.html"
if this.CheckActiveRedirect() {
return
}
var postMd models.Post
if this.loadPost(&postMd, &this.User) {
return
}
form := post.PostForm{}
form.SetFromPost(&postMd)
post.ListCategories(&form.Categories)
post.ListTopics(&form.Topics)
this.SetFormSets(&form)
}
示例3: EditPost
func (this *PostRouter) EditPost() {
this.TplNames = "post/edit.html"
if this.CheckActiveRedirect() {
return
}
var postMd models.Post
if this.loadPost(&postMd, &this.User) {
return
}
//if !postMd.CanEdit {
// this.Redirect(postMd.Link(), 302)
//}
form := post.PostForm{}
form.SetFromPost(&postMd)
post.ListTopics(&form.Topics)
this.SetFormSets(&form)
}