Merge branch 'master' of https://github.com/sagidayan/SE-Hub into matanBranch

This commit is contained in:
Matan Bar Yosef 2015-06-10 16:06:07 +03:00
commit 031bcf6f10
2 changed files with 14 additions and 6 deletions

View file

@ -143,11 +143,12 @@ def get_campuses(token):
"""
if is_user_token_valid(token):
arr = []
query = User.all()
query = Campus.all()
for c in query.run():
arr.append(c.to_JSON)
arr.append(dict(json.loads(c.to_JSON())))
print arr
if len(arr) != 0:
return Response(response=json.dumps([]),
return Response(response=json.dumps(arr),
status=200,
mimetype="application/json")
else:

View file

@ -11,7 +11,7 @@ class Campus(db.Model):
master_user_id = db.IntegerProperty(required=True)
def to_JSON(self):
dick = {'title': self.username,
dick = {'title': self.title,
'email_ending': self.email_ending,
'master_user_id': self.master_user_id,
'avatar_url': self.avatar_url
@ -21,5 +21,12 @@ class Campus(db.Model):
"""
DEBUG Script - To create a campus:
"""
is_jce_in = False
query = Campus.all()
query.filter('title =', 'JCE')
for c in query.run():
is_jce_in = True
if not is_jce_in:
jce = Campus(title='JCE', email_ending='@post.jce.ac.il', master_user_id=111, avatar_url='https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg')
db.put(jce)