This repository has been archived by the owner on May 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathmodels.py
76 lines (57 loc) · 1.82 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import sae
import web
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String , Text , DateTime
Base = declarative_base()
class Article(Base):
__tablename__ = 'articles'
aid = Column(Integer ,primary_key = True)
title = Column(String(100))
content = Column(Text)
posttime = Column(DateTime)
classid = Column(Integer)
classname = Column(String(20))
pv = Column(Integer)
tags = Column(String(50))
commentnumber = Column(Integer)
summary = Column(Text)
# def __init__(self,title,content):
# self.title = title
# self.content = content
# def __repr__(self):
# return "<Arcticle('%d','%s','%s','%s','%d','%s','%d')>"
# %(self.id , self.title , self.content , self.posttime , self.classid , self.tags , self.commentnumber)
class Comment(Base):
__tablename__ = 'comments'
cid = Column(Integer ,primary_key = True)
aid = Column(Integer)
posttime= Column(DateTime)
content = Column(Text)
email = Column(String(50))
username= Column(String(20))
# def __init__(self, aid, posttime , content , email , username):
# self.aid = aid
# self.posttime = posttime
# self.content = content
# self.email = email
# self.username = username
# def __repr__(self):
# return "Comment<'%s' , '%s' , '%s'>" /
# %(self.posttime , self.content , self.username)
class Classes(Base):
__tablename__ = 'classes'
classid = Column(Integer , primary_key = True )
classname = Column(String(20))
# def __init__(self, classname):
# self.classname = classname
# def __repr__(self):
# return "Classes<'%s','%s'>" /
# %(self.classid , self.classname)
#
class Admins(Base):
__tablename__ = 'admins'
uid = Column(Integer , primary_key = True )
username = Column(String(20))
userpass = Column(String(100))