-
Notifications
You must be signed in to change notification settings - Fork 0
/
faqna_models.py
executable file
·61 lines (43 loc) · 1.64 KB
/
faqna_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
#!/usr/bin/env python
from google.appengine.ext import db
class User(db.Model):
handle = db.StringProperty(required=True)
email = db.EmailProperty(required=True)
password = db.StringProperty(required=True)
#relation index entities
#seller side
class Product(db.Model):
user = db.ReferenceProperty(reference_class=User,collection_name='products',required=True)
title = db.StringProperty()
description = db.TextProperty()
class ProductTags(db.Model):
tags = db.StringListProperty(default=[])
#class ProductSubscription(db.Model):
# user = db.ReferenceProperty(reference_class=User,required=True)
# product = db.ReferenceProperty(reference_class=Product,required=True)
class Question(db.Model):
user = db.ReferenceProperty(reference_class=User)
product = db.ReferenceProperty(reference_class=Product,collection_name='questions',required=True)
text = db.StringProperty(required=True)
class Answer(db.Model):
user = db.ReferenceProperty(reference_class=User)
question = db.ReferenceProperty(reference_class=Question,collection_name='answers',required=True)
text = db.TextProperty(required=True)
#keyname
class Tag(db.Model):
name = db.StringProperty(required=True)
count = db.IntegerProperty(default=0)
#children
class TagProducts(db.Model):
products = db.ListProperty(db.Key)
class TagSimilar(db.Model):
similar = db.StringListProperty()
#buyerside
class Query(db.Model):
#list of tags
name = db.StringProperty()
tags = db.StringListProperty()
#parent is Query
class QueryProperty(db.Model):
question = db.StringProperty()
answer = db.StringProperty()