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 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 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 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)