diff --git a/SE_API/API.py b/SE_API/API.py index 1499197..a321dfd 100644 --- a/SE_API/API.py +++ b/SE_API/API.py @@ -7,11 +7,14 @@ import requests import uuid 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 flask.ext.autodoc import Autodoc +# DB Models +from models.User import User + @@ -124,20 +127,3 @@ def cookieMonster(uid): response = app.make_response(redirect_to_home ) response.set_cookie('com.sehub.www',value=uid) return response - - - - -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 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