summaryrefslogtreecommitdiffstats
path: root/models.py
diff options
context:
space:
mode:
authorThibaut Horel <thibaut.horel@gmail.com>2014-07-09 08:53:42 -0400
committerThibaut Horel <thibaut.horel@gmail.com>2014-07-09 08:53:42 -0400
commit1b1c13d22aaa7a7a2d334dde5783e5632fa572fa (patch)
tree767a6710f829766c04bfda60e4cab4670a373458 /models.py
parentd2496696d4ca73b9a8a43a42f31959ad6dc18c7a (diff)
downloadtracker-1b1c13d22aaa7a7a2d334dde5783e5632fa572fa.tar.gz
Logging of browser events
Diffstat (limited to 'models.py')
-rw-r--r--models.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/models.py b/models.py
index 68b3e53..fcdb0a3 100644
--- a/models.py
+++ b/models.py
@@ -25,7 +25,8 @@ class Event:
time = Column(DateTime)
def __init__(self, **args):
- self.time = datetime.utcnow()
+ if "time" not in args:
+ self.time = datetime.utcnow()
for key, value in args.iteritems():
setattr(self, key, value)
@@ -85,6 +86,15 @@ class WindowEvent(Event, Base):
class1 = Column(String)
class2 = Column(String)
+
+class BrowserEvent(Event, Base):
+
+ __tablename__ = "browser_events"
+
+ url = Column(String)
+ title = Column(String)
+
+
if __name__ == "__main__":
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker