Пример #1
0
 def addTag(self, noteId, strTag):
     count = Tag.select().where(Tag.tag == strTag).count()
     if (count == 0):
         dbTag = Tag()
         dbTag.creationDate = dbTag.modificationDate = datetime.date.today()
         dbTag.tag = strTag
         dbTag.save()
     else:
         dbTag = Tag.get(Tag.tag == strTag)
         
     note = Note.get(Note.id == noteId)
     noteTag = NoteTag()
     noteTag.note = note
     noteTag.tag = dbTag
     noteTag.creationDate = noteTag.modificationDate = datetime.date.today()
     noteTag.save() 
     
     self.view.execute_script("notesMD.tags = " + RuntimeSettings.getTags())
Пример #2
0
 def deleteNote(self, id):
     note = Note.get(Note.id == id)
     note.delete_instance()
     for noteTag in NoteTag.select().where(NoteTag.note == id):
         noteTag.delete_instance()
     self.reload()
Пример #3
0
 def removeTag(self, noteId, strTag):
     tag = Tag.get(Tag.tag == strTag)
     NoteTag.get(NoteTag.note == noteId, NoteTag.tag == tag.id).delete_instance()