diff --git a/SE_API/API.py b/SE_API/API.py index 3f7c71e..52075bf 100644 --- a/SE_API/API.py +++ b/SE_API/API.py @@ -10,6 +10,7 @@ from flask import Flask, request, render_template, redirect, abort # from User import User from flask.ext.github import GitHub from flask.ext.cors import CORS, cross_origin +from models.User import User @@ -115,16 +116,23 @@ def cookieMonster(uid): -class User(db.Model): - username = db.StringProperty(required=True) - name = db.StringProperty(required=True) - email = db.StringProperty(required=True) - isLecturer = db.BooleanProperty(required=True) - accsessToken = db.StringProperty(required=True) - seToken = db.StringProperty(required=True) - avatar_url = db.StringProperty(required=True) - isFirstLogin = db.BooleanProperty(default=True) - - def to_JSON(self): - return json.dumps(self, default=lambda o: o.__dict__, - sort_keys=True, indent=4) \ No newline at end of file +# class User(db.Model): +# username = db.StringProperty(required=True) +# name = db.StringProperty(required=True) +# email = db.StringProperty(required=True) +# isLecturer = db.BooleanProperty(required=True) +# accsessToken = db.StringProperty(required=True) +# seToken = db.StringProperty(required=True) +# avatar_url = db.StringProperty(required=True) +# isFirstLogin = db.BooleanProperty(default=True) +# +# def to_JSON(self): +# dick = {'username' : self.username, +# 'name' : self.name, +# 'email' : self.email, +# 'isLecturer' : self.isLecturer, +# 'seToken' : self.seToken, +# 'avatar_url' : self.avatar_url, +# 'isFirstLogin' : self.isFirstLogin, +# } +# return json.dumps(dick) \ No newline at end of file diff --git a/User/User.py b/User/User.py deleted file mode 100644 index 8d04163..0000000 --- a/User/User.py +++ /dev/null @@ -1,4 +0,0 @@ -from google.appengine.ext import db - - - diff --git a/User/__init__.py b/User/__init__.py deleted file mode 100644 index 066a6b3..0000000 --- a/User/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__author__ = 'sagi' diff --git a/models/User.py b/models/User.py new file mode 100644 index 0000000..e2aa922 --- /dev/null +++ b/models/User.py @@ -0,0 +1,25 @@ +import json + +__author__ = 'Aran' +from google.appengine.ext import db + +class User(db.Model): + username = db.StringProperty(required=True) + name = db.StringProperty(required=True) + email = db.StringProperty(required=True) + isLecturer = db.BooleanProperty(required=True) + accsessToken = db.StringProperty(required=True) + seToken = db.StringProperty(required=True) + avatar_url = db.StringProperty(required=True) + isFirstLogin = db.BooleanProperty(default=True) + + def to_JSON(self): + dick = {'username' : self.username, + 'name' : self.name, + 'email' : self.email, + 'isLecturer' : self.isLecturer, + 'seToken' : self.seToken, + 'avatar_url' : self.avatar_url, + 'isFirstLogin' : self.isFirstLogin, + } + return json.dumps(dick) \ No newline at end of file