Add API for location

This commit is contained in:
Arne Schlüter 2015-02-07 17:19:22 +01:00
commit 13791c0599
2 changed files with 25 additions and 0 deletions

View file

@ -1,3 +1,4 @@
import json
from peewee import *
db = SqliteDatabase('violence.db')
@ -6,6 +7,15 @@ class BaseModel(Model):
class Meta:
database = db
def __str__(self):
r = {}
for k in self._data.keys():
try:
r[k] = str(getattr(self, k))
except:
r[k] = json.dumps(getattr(self, k))
return str(r)
class Article(BaseModel):
"""
An article is a single incident as crawled from the reach-out webpage