aboutsummaryrefslogtreecommitdiff
path: root/src/web/models
diff options
context:
space:
mode:
authorFrançois Schmidts <francois.schmidts@gmail.com>2015-09-11 18:28:12 +0200
committerFrançois Schmidts <francois.schmidts@gmail.com>2016-01-26 23:46:30 +0100
commit462f6d3b21558ed0a283c24e0e0332eac6ccbbb3 (patch)
tree451c583b5f47bbf6e38743881c66f2f27371bd82 /src/web/models
parentmoving the root of source code from / to /src/ (diff)
downloadnewspipe-462f6d3b21558ed0a283c24e0e0332eac6ccbbb3.tar.gz
newspipe-462f6d3b21558ed0a283c24e0e0332eac6ccbbb3.tar.bz2
newspipe-462f6d3b21558ed0a283c24e0e0332eac6ccbbb3.zip
base modification in model for category support
Diffstat (limited to 'src/web/models')
-rw-r--r--src/web/models/__init__.py3
-rw-r--r--src/web/models/article.py11
-rw-r--r--src/web/models/feed.py1
3 files changed, 8 insertions, 7 deletions
diff --git a/src/web/models/__init__.py b/src/web/models/__init__.py
index 54168279..81ebe361 100644
--- a/src/web/models/__init__.py
+++ b/src/web/models/__init__.py
@@ -31,8 +31,9 @@ from .role import Role
from .user import User
from .article import Article
from .icon import Icon
+from .category import Category
-__all__ = ['Feed', 'Role', 'User', 'Article', 'Icon']
+__all__ = ['Feed', 'Role', 'User', 'Article', 'Icon', 'Category']
import os
diff --git a/src/web/models/article.py b/src/web/models/article.py
index 54eefe75..44a4234d 100644
--- a/src/web/models/article.py
+++ b/src/web/models/article.py
@@ -32,10 +32,8 @@ from sqlalchemy import asc, desc
class Article(db.Model):
- """
- Represent an article from a feed.
- """
- id = db.Column(db.Integer, primary_key=True)
+ "Represent an article from a feed."
+ id = db.Column(db.Integer(), primary_key=True)
entry_id = db.Column(db.String())
link = db.Column(db.String())
title = db.Column(db.String())
@@ -46,8 +44,9 @@ class Article(db.Model):
date = db.Column(db.DateTime(), default=datetime.now)
retrieved_date = db.Column(db.DateTime(), default=datetime.now)
- user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
- feed_id = db.Column(db.Integer, db.ForeignKey('feed.id'))
+ user_id = db.Column(db.Integer(), db.ForeignKey('user.id'))
+ feed_id = db.Column(db.Integer(), db.ForeignKey('feed.id'))
+ category_id = db.Column(db.Integer(), db.ForeignKey('category.id'))
def previous_article(self):
"""
diff --git a/src/web/models/feed.py b/src/web/models/feed.py
index 59456a7f..87616e02 100644
--- a/src/web/models/feed.py
+++ b/src/web/models/feed.py
@@ -56,6 +56,7 @@ class Feed(db.Model):
# relationship
icon_url = db.Column(db.String(), db.ForeignKey('icon.url'), default=None)
user_id = db.Column(db.Integer(), db.ForeignKey('user.id'))
+ category_id = db.Column(db.Integer(), db.ForeignKey('category.id'))
articles = db.relationship('Article', backref='source', lazy='dynamic',
cascade='all,delete-orphan',
order_by=desc("Article.date"))
bgstack15