Add tags to dashboard
This commit is contained in:
21
db.py
21
db.py
@@ -275,3 +275,24 @@ class DataBase():
|
||||
def delete_tag_for_person(self, person_id, tag_id):
|
||||
self.execute('DELETE FROM Tag WHERE person_id=%s AND tag_id=%s', [
|
||||
person_id, tag_id], commit=True)
|
||||
|
||||
def get_tags_for_dashboard(self):
|
||||
return self.execute("""
|
||||
SELECT
|
||||
T.tag_id AS "TagId",
|
||||
T.person_id AS "PersonId",
|
||||
T.name AS "TagName",
|
||||
T.filter AS "TagFilter"
|
||||
FROM
|
||||
Tag T
|
||||
WHERE
|
||||
T.person_id IS NULL
|
||||
ORDER BY
|
||||
T.name""", [])
|
||||
|
||||
def add_tag_for_dashboard(self, tag_name, tag_filter):
|
||||
self.execute('INSERT INTO Tag (name, filter) VALUES (%s, %s)', [
|
||||
tag_name, tag_filter], commit=True)
|
||||
|
||||
def delete_tag_for_dashboard(self, tag_id):
|
||||
self.execute('DELETE FROM Tag WHERE tag_id=%s', [tag_id], commit=True)
|
||||
|
||||
Reference in New Issue
Block a user