Ejemplo n.º 1
0
class Movies(mongo.Document):
    meta = {'strict': False}
    projections = [
        '_id', 'budget', 'homepage', 'imdb_id', 'original_title', 'overview',
        'release_date', 'runtime', 'tagline'
    ]

    _id = mongo.ObjectIdField()
    original_title = mongo.StringField()
    overview = mongo.StringField()
    tagline = mongo.StringField()
    runtime = mongo.IntField()
    budget = mongo.IntField()
    homepage = mongo.StringField()
    release_date = mongo.DateTimeField()

    def __repr__(self):
        return '{} - id: {}: {}'.format(str(self.__class__), self._id,
                                        self.original_title)

    @classmethod
    def search(cls, query, page, per_page):
        ids, total = query_index(query, page, per_page)
        if total == 0:
            return [], 0
        movies = Movies.objects(_id__in=ids)
        return movies, total
Ejemplo n.º 2
0
class Phone(mongo.Document):

    brand = mongo.StringField(max_length=255, required=True)
    model = mongo.StringField(max_length=255, required=True)

    sentiments = mongo.ListField(mongo.EmbeddedDocumentField('Sentiment'))
    specifications = mongo.DictField(default={}, required=True)
    pros_cons = mongo.ListField(mongo.EmbeddedDocumentField('ProsCons'))

    def __unicode__(self):
        return "%s : %s" % (self.brand, self.model)
Ejemplo n.º 3
0
class History(mongo.Document):
    user = mongo.StringField(required=True)
    thumbnail = mongo.StringField(required=False)
    timestamp = mongo.StringField(required=True)
    text = mongo.StringField(required=True)
    source_files = mongo.ListField(required=False)

    @staticmethod
    def get_history_by_user(username):
        return History.objects(user=username)

    @staticmethod
    def get_expired(expiration):
        return History.objects(timestamp__lt=expiration)
Ejemplo n.º 4
0
class ProsCons(mongo.EmbeddedDocument):
    about = mongo.StringField(required=True)
    positive = mongo.ListField(mongo.EmbeddedDocumentField('Review'),
                               required=True,
                               default=[])
    negative = mongo.ListField(mongo.EmbeddedDocumentField('Review'),
                               required=True,
                               default=[])
Ejemplo n.º 5
0
class Listing(mongo.Document):
    title = mongo.StringField()
    description = mongo.StringField()
    employer = mongo.StringField()
    student_matches = mongo.ListField(
        mongo.TupleField(mongo.StringField(), mongo.FloatField()))
    salary = mongo.FloatField()
    location = mongo.StringField()
    desired_skills = mongo.ListField(mongo.StringField())
    job_type = mongo.ListField(mongo.StringField())
Ejemplo n.º 6
0
class Employer(mongo.Document):
    company_name = mongo.StringField()
    description = mongo.StringField()
    num_employees = mongo.IntField()
    username = mongo.StringField()
    email = mongo.StringField()
    password = mongo.StringField()
    location = mongo.StringField()
Ejemplo n.º 7
0
class Article(mongo.Document):
    id = mongo.IntField(unique=True)
    ArtName = mongo.StringField()
    ArtSingleInfo = mongo.StringField(max_langth=100)
    ArtAllInfo = mongo.StringField()
    FirstDevide = mongo.StringField()
    SecondDevide = mongo.StringField()
    images = mongo.StringField()
    Source = mongo.FileField()
Ejemplo n.º 8
0
class Skill(mongo.Document):
    name = mongo.StringField()
Ejemplo n.º 9
0
class Student(mongo.Document):
    username = mongo.StringField()
    first_name = mongo.StringField()
    last_name = mongo.StringField()
    email = mongo.StringField()
    password = mongo.StringField()
    linkedin_token = mongo.StringField()
    github_token = mongo.StringField()
    skills = mongo.ListField(mongo.StringField())
    location = mongo.StringField()
    need_visa = mongo.StringField()
    looking_for = mongo.ListField(mongo.StringField())  # list
    job_matches = mongo.ListField(
        mongo.TupleField(
            mongo.StringField(),
            mongo.FloatField()))  # [(match_id1, .33), (match_id2, .5)]
    favorited_jobs = mongo.ListField(mongo.StringField())  # list
    declined_jobs = mongo.ListField(mongo.StringField())  # list
Ejemplo n.º 10
0
class User(mongo.Document):
    name = mongo.StringField()
    email = mongo.StringField()
    password = mongo.StringField()
Ejemplo n.º 11
0
class Review(mongo.EmbeddedDocument):

    review = mongo.StringField(required=True)
    num_users = mongo.IntField(default=0, required=True)
Ejemplo n.º 12
0
class Sentiment(mongo.EmbeddedDocument):
    about = mongo.StringField(required=True)
    positive = mongo.IntField(default=0, required=True)
    neutral = mongo.IntField(default=0, required=True)
    negative = mongo.IntField(default=0, required=True)
Ejemplo n.º 13
0
class Tian(mongo.Document):
    time = mongo.StringField()
    tianqi = mongo.StringField()
    high = mongo.StringField()
    low = mongo.StringField()
Ejemplo n.º 14
0
class Resources(mongo.Document):
    task_uuid = mongo.StringField(required=True)
    data = mongo.StringField(required=True)
    timestamp = mongo.DateTimeField()