-
Notifications
You must be signed in to change notification settings - Fork 46
/
models.py
61 lines (55 loc) · 1.96 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import text
from flask_sqlalchemy import SQLAlchemy
# Initialize SQLAlchemy with the app
db = SQLAlchemy()
# Define models
class Topics(db.Model):
__tablename__ = 'topics'
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.Text)
level = db.Column(db.Integer)
parent = db.Column(db.Integer, db.ForeignKey('topics.id')) # Zelf-referentiële ForeignKey
path = db.Column(db.Text)
draft = db.Column(db.Text)
subtopics = db.relationship('Topics',
backref=db.backref('parent_topic', remote_side=[id]),
lazy='dynamic',
foreign_keys='Topics.parent')
class articles(db.Model):
id = db.Column(db.Integer, primary_key=True)
type = db.Column(db.Text)
title = db.Column(db.Text)
parent = db.Column(db.Integer)
description = db.Column(db.Text)
path = db.Column(db.Text)
keywords = db.Column(db.Text)
date = db.Column(db.Text)
date_modified = db.Column(db.Text)
draft = db.Column(db.Text)
weight = db.Column(db.Integer)
author = db.Column(db.Text)
content = db.Column(db.Text)
class Contributors(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.Text)
description_short = db.Column(db.Text)
description_long = db.Column(db.Text)
skills = db.Column(db.Text)
linkedin = db.Column(db.Text)
facebook = db.Column(db.Text)
twitter = db.Column(db.Text)
email = db.Column(db.Text)
image = db.Column(db.Text)
status = db.Column(db.Text)
path = db.Column(db.Text)
content = db.Column(db.Text)
class blogs(db.Model):
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.Text)
description = db.Column(db.Text)
path = db.Column(db.Text)
date = db.Column(db.Text)
date_modified = db.Column(db.Text)
draft = db.Column(db.Text)
content = db.Column(db.Text)