forked from axeleroy/untoitpourcaramel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
33 lines (27 loc) · 841 Bytes
/
models.py
File metadata and controls
33 lines (27 loc) · 841 Bytes
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
from peewee import *
from playhouse.sqlite_ext import SqliteExtDatabase
db = SqliteExtDatabase('database.sqlite')
class Annonce(Model):
# id = "pap-123456789"
id = CharField(unique=True, primary_key=True)
# site = [pap, lbc, logic-immo, seloger]
site = CharField()
created = DateTimeField()
title = CharField()
description = TextField(null=True)
telephone = TextField(null=True)
price = FloatField()
charges = FloatField(null=True)
surface = FloatField()
rooms = IntegerField()
bedrooms = IntegerField(null=True)
city = CharField()
link = CharField()
picture = CharField(null=True)
posted2trello = BooleanField(default=False)
class Meta:
database = db
order_by = ('-created',)
def create_tables():
with db:
db.create_tables([Annonce])