-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
30 lines (21 loc) · 741 Bytes
/
models.py
File metadata and controls
30 lines (21 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import cgi
import os
import datetime
from google.appengine.ext import db
from google.appengine.api import users
class User(db.Model):
google_user = db.UserProperty()
firstName = db.StringProperty()
lastName = db.StringProperty()
friends = db.ListProperty(users.User, indexed=True)
@staticmethod
def get_by_google_user(g_user):
return User.all().filter('google_user = ', g_user).get()
class SomeEntity(db.Model):
name = db.StringProperty(required=True)
user = db.ReferenceProperty(User)
tags = db.ListProperty(db.Category)
text = db.StringProperty(required=True)
@staticmethod
def get_by_name(name):
return SomeEntity.all().filter('name = ', name).get()