Merge branch 'master' of https://github.com/sagidayan/SE-Hub into matanBranch
This commit is contained in:
commit
031bcf6f10
2 changed files with 14 additions and 6 deletions
|
@ -143,11 +143,12 @@ def get_campuses(token):
|
||||||
"""
|
"""
|
||||||
if is_user_token_valid(token):
|
if is_user_token_valid(token):
|
||||||
arr = []
|
arr = []
|
||||||
query = User.all()
|
query = Campus.all()
|
||||||
for c in query.run():
|
for c in query.run():
|
||||||
arr.append(c.to_JSON)
|
arr.append(dict(json.loads(c.to_JSON())))
|
||||||
|
print arr
|
||||||
if len(arr) != 0:
|
if len(arr) != 0:
|
||||||
return Response(response=json.dumps([]),
|
return Response(response=json.dumps(arr),
|
||||||
status=200,
|
status=200,
|
||||||
mimetype="application/json")
|
mimetype="application/json")
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Campus(db.Model):
|
||||||
master_user_id = db.IntegerProperty(required=True)
|
master_user_id = db.IntegerProperty(required=True)
|
||||||
|
|
||||||
def to_JSON(self):
|
def to_JSON(self):
|
||||||
dick = {'title': self.username,
|
dick = {'title': self.title,
|
||||||
'email_ending': self.email_ending,
|
'email_ending': self.email_ending,
|
||||||
'master_user_id': self.master_user_id,
|
'master_user_id': self.master_user_id,
|
||||||
'avatar_url': self.avatar_url
|
'avatar_url': self.avatar_url
|
||||||
|
@ -21,5 +21,12 @@ class Campus(db.Model):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
DEBUG Script - To create a campus:
|
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)
|
Loading…
Reference in a new issue