handlers/articles/articles.go
func Edit(c *gin.Context) {
	db := c.MustGet("db").(*mgo.Database)
	article := models.Article{}
	oID := bson.ObjectIdHex(c.Param("_id"))
	err := db.C(models.CollectionArticle).FindId(oID).One(&article)
	if err != nil {
		c.Error(err)
	}

	c.HTML(http.StatusOK, "articles/form", gin.H{
		"title":   "Edit article",
		"article": article,
	})
}
func Edit(c *gin.Context) {
	db := c.MustGet("db").(*mgo.Database)
	article := models.Article{}
	oID := bson.ObjectIdHex(c.Param("_id"))
	err := db.C(models.CollectionArticle).FindId(oID).One(&article)
	if err != nil {
		c.Error(err)
	}

	c.HTML(http.StatusOK, "articles/form", gin.H{
		"title":   "Edit article",
		"article": article,
	})
}
func Edit ( c * gin . Context ) { db := c . MustGet ( " " ) . ( * mgo . Database ) article := models . Article { } oID := bson . ObjectIdHex ( c . Param ( " " ) ) err := db . C ( models . CollectionArticle ) . FindId ( oID ) . One ( & article ) if err != nil { c . Error ( err ) } c . HTML ( http . StatusOK , " " , gin . H { " " : " " , " " : article , } ) }
// Edit an article
Edit an article