Conversion tool is near from complete. Use Peewee as ORM

This commit is contained in:
Yax 2015-05-01 18:57:17 +02:00
parent 451bf1915e
commit 7441a80217
7 changed files with 140 additions and 19 deletions

24
app/models/comment.py Normal file
View file

@ -0,0 +1,24 @@
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from peewee import Model
from peewee import CharField
from peewee import DateTimeField
from peewee import IntegerField
from peewee import ForeignKeyField
from app.models.site import Site
from app.services.database import get_db
class Comment(Model):
url = CharField()
date = DateTimeField()
rel_index = IntegerField()
author_name = CharField()
author_email = CharField(default='')
author_site = CharField()
content = CharField()
site = ForeignKeyField(Site, related_name='site')
class Meta:
database = get_db()

15
app/models/site.py Normal file
View file

@ -0,0 +1,15 @@
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from peewee import Model
from peewee import CharField
from app.services.database import get_db
class Site(Model):
name = CharField(unique=True)
url = CharField()
token = CharField()
class Meta:
database = get_db()