예제 #1
0
// view for list model data
func (this *ArticleAdminRouter) List() {
	var articles []models.Article
	qs := models.Articles().RelatedSel()
	if err := this.SetObjects(qs, &articles); err != nil {
		this.Data["Error"] = err
		beego.Error(err)
	}
}
예제 #2
0
func (this *ArticleRouter) loadArticle(article *models.Article) bool {
	uri := this.Ctx.Request.RequestURI
	err := models.Articles().RelatedSel("User").Filter("IsPublish", true).Filter("Uri", uri).One(article)
	if err == nil {
		this.Data["Article"] = article
	} else {
		this.Abort("404")
	}
	return err != nil
}
예제 #3
0
func (this *ArticleAdminRouter) ObjectQs() orm.QuerySeter {
	return models.Articles().RelatedSel()
}