aboutsummaryrefslogtreecommitdiff
path: root/src/web/models/tag.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-11-08 14:39:47 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-11-08 14:39:47 +0100
commit2d72f44a90a76fe7450e59fdfdf4d42f44b9cd96 (patch)
tree39895c10f68cf0b13d957073268769d04aa924a0 /src/web/models/tag.py
parentCloses section HTML tag. (diff)
downloadnewspipe-2d72f44a90a76fe7450e59fdfdf4d42f44b9cd96.tar.gz
newspipe-2d72f44a90a76fe7450e59fdfdf4d42f44b9cd96.tar.bz2
newspipe-2d72f44a90a76fe7450e59fdfdf4d42f44b9cd96.zip
various improvements to the crawler (better use of coroutines, test if an article should be updated). tags are now retrieved for the k-means clustering (previously achived with the content of articles)
Diffstat (limited to 'src/web/models/tag.py')
-rw-r--r--src/web/models/tag.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/web/models/tag.py b/src/web/models/tag.py
new file mode 100644
index 00000000..8d7fe4d4
--- /dev/null
+++ b/src/web/models/tag.py
@@ -0,0 +1,22 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from sqlalchemy import Column, ForeignKey, Integer, String
+from sqlalchemy.orm import relationship
+
+from bootstrap import db
+
+
+class Tag(db.Model):
+ text = Column(String, primary_key=True, unique=False)
+
+ # foreign keys
+ article_id = Column(Integer, ForeignKey('article.id', ondelete='CASCADE'),
+ primary_key=True)
+
+ # relationships
+ article = relationship('Article', back_populates='tag_objs',
+ foreign_keys=[article_id])
+
+ def __init__(self, text):
+ self.text = text
bgstack15