forked from garethr/appengine-image-host
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodels.py
69 lines (60 loc) · 2.52 KB
/
models.py
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
from google.appengine.ext import db
from google.appengine.api.users import User
from google.appengine.ext import blobstore
import sha
class RealmKeys(db.Model):
realm_name = db.StringProperty()
def fetch(self,key):
result = self.get(key)
if result:
return result
return None
class UploadRequestKeys(db.Model):
realm_key = db.ReferenceProperty(RealmKeys)
expire_date = db.DateTimeProperty()
class Image(db.Model):
"Represents an image stored in the datastore"
# blog properties storing up to 1MB of binary data
image = db.BlobProperty()
thumb = db.BlobProperty()
original = db.BlobProperty()
# store the date just in case
date = db.DateTimeProperty(auto_now_add=True)
# all images are associated with the user who uploades them
# this way we can make it a multi user system if that's useful
user = db.UserProperty()
realm = db.ReferenceProperty(RealmKeys)
#cat = db.ReferenceProperty(Category,collection_name='images')
class File(db.Model):
"Represents a file stored in the datastore either css or java"
# blog properties storing up to 1MB of binary data
name = db.StringProperty()
file = db.BlobProperty()
original = db.BlobProperty()
content_type = db.StringProperty()
# store the date just in case
date = db.DateTimeProperty(auto_now_add=True)
# all images are associated with the user who uploades them
# this way we can make it a multi user system if that's useful
user = db.UserProperty()
#cat = db.ReferenceProperty(Category,collection_name='cssfiles')
class TemplateFile(db.Model):
"Represents a file stored in the datastore"
# blog properties storing up to 1MB of binary data
name = db.TextProperty()
file = db.BlobProperty()
# store the date just in case
date = db.DateTimeProperty(auto_now_add=True)
# all images are associated with the user who uploades them
# this way we can make it a multi user system if that's useful
user = db.UserProperty()
realm = db.ReferenceProperty(RealmKeys)
#cat = db.ReferenceProperty(Category,collection_name='cssfiles')
class BlobFile(db.Model):
"Represents a file stored in the datastore"
name = db.TextProperty()
blobkey = blobstore.BlobReferenceProperty()
date = db.DateTimeProperty(auto_now_add=True)
user = db.UserProperty()
realm = db.ReferenceProperty(RealmKeys)
#cat = db.ReferenceProperty(Category,collection_name='blobfiles')