示例#1
0
class PiInfo(db.Document):
    ip = db.StringField()
    mac = db.StringField()
    description = db.StringField()
    alias = db.StringField()

    def get_absoluter_url(self):
        return url_for('post', kwargs={"slug": self.slug})

    def __unicode__(self):
        return self.ip
示例#2
0
class Data(db.Document):
    domain = db.StringField()
    address = db.StringField()
    property = db.StringField()
    timestamp = db.DateTimeField(unique=True)
    value = db.IntField()

    def get_absolute_url(self):
        return url_for('post', kwargs={"slug": self.slug})

    def __unicode__(self):
        return self.address
示例#3
0
class User(db.Document, UserMixin):
    username = db.StringField(required=True, unique=True)
    email = db.EmailField(required=True, unique=True)
    password = db.StringField(required=True)
    profile_pic = db.ImageField()
    otp_secret = db.StringField(required=True,
                                min_length=16,
                                max_length=16,
                                default=pyotp.random_base32())

    # Returns unique string identifying our object
    def get_id(self):
        return self.username
示例#4
0
class Bill(db.Document):
    orden = db.IntField(default=10000, required=True, primary_key=True)
    client_orden = db.IntField(required=True)
    session_id = db.StringField(max_length=200, required=True)
    amount = db.IntField(required=True)
    ip = db.StringField(max_length=15, required=True)
    state = db.ReferenceField(State)
    succ_url = db.URLField(required=True)
    fail_url = db.URLField(required=True)
    auth_code = db.IntField()
    trx_id = db.IntField()
    trx_date = db.DateTimeField()
    last_digits = db.IntField()
    tipo_cuota = db.StringField(max_length=200)
    num_cuota = db.IntField()
    message = db.StringField(max_length=200)

    meta = {'ordering': ['orden']}
示例#5
0
class Post(db.DynamicDocument):
    created_at = db.DateTimeField(default=datetime.datetime.now, required=True)
    title = db.StringField(max_length=255, required=True)
    slug = db.StringField(max_length=255, required=True)
    body = db.StringField(required=True)
    comments = db.ListField(db.EmbeddedDocumentField('Comment')) #make a array save the comments .

    def get_absolute_url(self):
        return url_for('post', kwargs={"slug": self.slug})

    def __unicode__(self):
        return self.title

    @property
    def post_type(self):
        return self.__class__.__name__

    meta = {
        'allow_inheritance': True,
        'indexes': ['-created_at', 'slug'],
        'ordering': ['-created_at']
    }
示例#6
0
class Zhihu(db.Document):
    meta = {
        'collection': 'ZhihuItem',
        'ordering': ['-add_time'],
        'strict': False,
    }
    title = db.StringField()
    content = db.StringField()
    message_url = db.StringField()
    id = db.StringField()
    image_url = db.StringField()
    source_from = db.StringField()
    add_time = db.DateTimeField(default=datetime.utcnow)

    def to_json(self):
        json_douban = {
            'title': self.title,
            'content': self.content,
            'message_url': self.message_url,
            'image_url': self.image_url,
            'source_from': self.source_from
        }
        return json_douban
示例#7
0
class State(db.Document):
	name = db.StringField(max_length=50, required=True)

	def __unicode__(self):
		return self.name
示例#8
0
class Quote(Post):
    body = db.StringField(required=True)
    author = db.StringField(verbose_name="Author Name",required=True, max_length=255)
示例#9
0
class Comment(db.EmbeddedDocument):
    created_at = db.DateTimeField(default=datetime.datetime.now, required=True)
    body = db.StringField(verbose_name="Comment", required=True)
    author = db.StringField(verbose_name="Name", max_length=255, required=True)
示例#10
0
class Image(Post):
    image_url = db.StringField(required=True, max_length=255)
示例#11
0
class Video(Post):
    embed_code = db.StringField(required=True)
示例#12
0
class BlogPost(Post):
    body = db.StringField(required=True)
示例#13
0
class CatImage(db.Document):
    commenter = db.ReferenceField(User, required=True)
    im = db.ImageField()
    date = db.StringField(required=True)
    cat_name = db.StringField(required=True, min_length=1, max_length=100)
示例#14
0
class Review(db.Document):
    commenter = db.ReferenceField(User, required=True)
    content = db.StringField(required=True, min_length=5, max_length=500)
    date = db.StringField(required=True)
    cat_name = db.StringField(required=True, min_length=1, max_length=100)