aboutsummaryrefslogtreecommitdiff
path: root/src/web/models/article.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/article.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/article.py')
-rw-r--r--src/web/models/article.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/web/models/article.py b/src/web/models/article.py
index 23708f6b..5261cb0d 100644
--- a/src/web/models/article.py
+++ b/src/web/models/article.py
@@ -29,6 +29,8 @@ __license__ = "GPLv3"
from bootstrap import db
from datetime import datetime
from sqlalchemy import asc, desc, Index
+from sqlalchemy.ext.associationproxy import association_proxy
+
from web.models.right_mixin import RightMixin
@@ -49,6 +51,13 @@ class Article(db.Model, RightMixin):
feed_id = db.Column(db.Integer(), db.ForeignKey('feed.id'))
category_id = db.Column(db.Integer(), db.ForeignKey('category.id'))
+ # relationships
+ tag_objs = db.relationship('Tag', back_populates='article',
+ cascade='all,delete-orphan',
+ lazy=False,
+ foreign_keys='[Tag.article_id]')
+ tags = association_proxy('tag_objs', 'text')
+
# index
idx_article_uid = Index('user_id')
idx_article_uid_cid = Index('user_id', 'category_id')
bgstack15