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
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)
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)
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=[])
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())
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()
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()
class Skill(mongo.Document): name = mongo.StringField()
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
class User(mongo.Document): name = mongo.StringField() email = mongo.StringField() password = mongo.StringField()
class Review(mongo.EmbeddedDocument): review = mongo.StringField(required=True) num_users = mongo.IntField(default=0, required=True)
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)
class Tian(mongo.Document): time = mongo.StringField() tianqi = mongo.StringField() high = mongo.StringField() low = mongo.StringField()
class Resources(mongo.Document): task_uuid = mongo.StringField(required=True) data = mongo.StringField(required=True) timestamp = mongo.DateTimeField()