def notifyTag(ts: str): t = Tag.getDoc(ts) now = BzDateTime.now() if t: t.lastUsed = now t.timesUsed += 1 else: t = Tag(_id=ts, created=now, lastUsed=now, timesUsed=1) t.save()
def editMess(id): """ Edit an existing message """ m = models.Message.getDoc(id) mf = MessageForm(message=m.source) if request.method=='POST': mf = mf.populateFromRequest(request) previewH, tags = mark.render(mf.message) m.source = mf.message m.html = previewH m.tags = tags m.editedAt = BzDateTime.now() m.save() #//if tem = jinjaEnv.get_template("editMess.html") h = tem.render( m = m, id = id, ms = m.viewH(), mf = mf, ) return h
def preCreate(self): self.published = BzDateTime.now()
def preCreate(self): """ before saving, create the bioHtml """ self.created = BzDateTime.now()
def preSave(self): self.timestamp = BzDateTime.now()
def preSave(self): self.savedAt = BzDateTime.now()
def preSave(self): self.lastSaved = BzDateTime.now() d = self.mongoDict() d.pop('anything', "") # remove the anything field dpr("d=%r", d) self.anything = d