class SocialUser(db.Model): first_name = db.StringProperty(required=True) last_name = db.StringProperty(required=True) display_name = db.StringProperty() user_entity = db.UserProperty() bio = db.TextProperty() gender = db.StringProperty(choices=set(["M", "F", "U"])) birth_date = db.DateTimeProperty() email = db.EmailProperty(required=True) email_alternate = db.EmailProperty() mobile_number = db.PhoneNumberProperty() mailing_address = db.PostalAddressProperty() personal_website = db.LinkProperty() hometown = db.StringProperty() current_location = db.StringProperty() relationship_status = db.StringProperty() locale = db.StringProperty() timezone = db.StringProperty() enabled = db.BooleanProperty()
class AdmissionData(db.Model): """Database for AdmissionData.""" applicants_name = db.StringProperty(required=True) fathers_email = db.EmailProperty(required=True) fathers_phone = db.StringProperty(required=True) mothers_email = db.EmailProperty(required=True) mothers_phone = db.StringProperty(required=True) home_address = db.TextProperty(required=True) application_date = db.DateTimeProperty(auto_now_add=True)
class Post(db.Model): author = db.EmailProperty() last_updated_by = db.EmailProperty() title = db.StringProperty() slug = db.StringProperty() body = db.TextProperty() body_html = db.TextProperty() published = db.BooleanProperty() published_at = db.DateTimeProperty() created_at = db.DateTimeProperty(auto_now_add=True) updated_at = db.DateTimeProperty(auto_now=True) # tags = db.StringListProperty(default=[]) category = db.ReferenceProperty(Category, collection_name='posts') #ptag_regex = re.compile("<p>.*?<\/p>", re.DOTALL) @property def url(self): return "/posts/%s/%s" % (self.published_at.strftime("%Y/%m/%d"), self.slug) @property def summary(self): pos = self.body_html.find("</p>") if pos == -1: return self.body_html else: return self.body_html[:pos + 4] # def do_tags(self, raw_tags): # if raw_tags: # self.tags = [re.sub(r'\s+','-',t.strip()) for t in raw_tags.split(",")] # for tag_name in self.tags: # tag = Tag(key_name = tag_name) # tag.put() def do_category(self, cat_name): if cat_name: category = Category.all().filter('name = ', cat_name).get() if not category: category = Category(name=cat_name) category.put() self.category = category else: self.category = None # class Tag(db.Model): # created_at = db.DateTimeProperty(auto_now_add=True) # @property # def posts(self): # return Post.gql("WHERE tags = :1", self.key().name())
class Score(db.Model): subject = db.StringProperty( default=course.subject ) # subject for which we're collecting this grade email = db.EmailProperty(required=True) # who the entry is for timestamp = db.DateTimeProperty( auto_now=True) # use now() when writing a record submitter = db.EmailProperty() # None if result of autograding assignment = db.StringProperty() # which assignment, if applicable action = db.StringProperty() value = db.StringProperty() notes = db.StringProperty()
class User(CommonModel): firstName = db.StringProperty(required=True) lastName = db.StringProperty(required=True) email = db.EmailProperty(required=True) alternateEmail = db.EmailProperty(required=True) dob = db.DateProperty(required=True) about = db.TextProperty() createdOn = db.DateTimeProperty(auto_now_add=True) updatedOn = db.DateTimeProperty(auto_now=True) @property def name(self): return '%s %s' % (self.firstName, self.lastName)
class LogEntry(db.Model): mapping = db.ReferenceProperty(Mapping, required=True) server = db.ReferenceProperty(SmtpServer, required=True) ts = db.DateTimeProperty(required=True, auto_now_add=True) sender = db.EmailProperty(required=True) recipient = db.EmailProperty(required=True) length = db.IntegerProperty(required=True) message = db.TextProperty() is_error = db.BooleanProperty(required=True, default=False) is_warning = db.BooleanProperty(required=True, default=False) def human_size(self): return "%d kb" % math.ceil(self.length / 1024.0)
class User(db.Model): name = db.StringProperty(required=True) pw_hash = db.StringProperty(required=True) email = db.EmailProperty(required=False) # email = db.StringProperty(required=True) @classmethod def by_id(cls, uid): return User.get_by_id(uid) @classmethod def by_name(cls, name): return User.all().filter('name =', name).get() @classmethod def register(cls, name, pw, email=None): pw_hash = make_pw_hash(name, pw) return User(name=name, pw_hash=pw_hash, email=email) @classmethod def login(cls, name, pw): u = cls.by_name(name) if u and valid_pw(name, pw, u.pw_hash): return u
class TransactionDB(db.Model): date = db.DateProperty() plan = db.StringProperty() order_id = db.StringProperty() email = db.EmailProperty() price = db.FloatProperty()
class User(db.Model): """Models an individual Users account with a username, password, and email.""" username = db.StringProperty(required=True) password = db.StringProperty(required=True) email = db.EmailProperty() @classmethod def by_id(cls, uid): return User.get_by_id(uid, parent=users_key()) @classmethod def by_name(cls, name): return User.all().filter('username ='******'*****@*****.**'): pw_hash = make_pw_hash(name, pw) return User(parent=users_key(), username=name, password=pw_hash, email=email) @classmethod def login(cls, name, pw): u = cls.by_name(name) if u and valid_pw(name, pw, u.password): return u
class User(db.Model): @classmethod def new(cls): return User(enabled=0, restore_password=0) first_name = db.StringProperty() last_name = db.StringProperty() mobile_number = db.StringProperty(indexed=False) telephone_number = db.StringProperty(indexed=False) email = db.EmailProperty() rol = db.StringProperty(required=True, default='oper') password = db.StringProperty() gender = db.StringProperty(indexed=False) birthday = db.DateProperty(auto_now_add=True, indexed=False) realestate = db.ReferenceProperty(RealEstate) enabled = db.IntegerProperty() restore_password = db.IntegerProperty() updated_at = db.DateTimeProperty(auto_now=True) created_at = db.DateTimeProperty(auto_now_add=True) @property def full_name(self): return '%s %s' % (self.first_name if self.first_name else '', self.last_name if self.last_name else '') def __repr__(self): return self.name
class AppUser(db.Model): """ User authorization account with optional public fields """ # login fields email = db.EmailProperty(required=True) phash = db.StringProperty(required=True) status = db.StringProperty() # Pending|Active|Inactive|Unreachable actsends = db.TextProperty(indexed=False) # isodate;emaddr,d2;e2... actcode = db.StringProperty(indexed=False) # account activation code # optional public descriptive information name = db.StringProperty(indexed=False) title = db.StringProperty(indexed=False) web = db.StringProperty(indexed=False) # app working values lang = db.StringProperty() # preferred lang code for data points settings = db.TextProperty() # JSON object (age, parent's age etc) remtls = db.TextProperty() # JSON [] remembered timeline ids/names completed = db.TextProperty() # JSON [] tlid, name, first, latest started = db.TextProperty() # JSON [] timeline progress instances built = db.TextProperty() # JSON [] created timeline ids/names # write privileges orgid = db.IntegerProperty() # Organization id (if any). lev = db.IntegerProperty() # 0:User, 1:Contributor, 2:Administrator # activity sorting created = db.StringProperty() # ISO datetime accessed = db.StringProperty() # ISO datetime;count
class Staff(db.Model): Email = db.EmailProperty() First_Name = db.StringProperty() Last_Name = db.StringProperty() Contact_No = db.IntegerProperty() Address = db.StringProperty() postalCode = db.IntegerProperty()
class Article(db.Model): title = db.StringProperty(required=True, default="no title") content = db.TextProperty(required=True) tags = db.ListProperty(db.Category) author_mail = db.EmailProperty() link = db.LinkProperty(required=True) rating = db.RatingProperty()
class Account(db.Model): user = db.UserProperty() # Google Account (optional) email = db.EmailProperty() passwd = db.StringProperty() # sha1 name = db.StringProperty() created = db.DateTimeProperty(auto_now_add=True) updated = db.DateTimeProperty(auto_now=True)
class DeveloperKeys(db.Model): dateAdded = db.DateTimeProperty(auto_now_add=True) developerName = db.StringProperty() developerKey = db.StringProperty() developerEmail = db.EmailProperty() requestCounter = db.IntegerProperty() errorCounter = db.IntegerProperty()
class User(polymodel.PolyModel): since = db.DateTimeProperty(auto_now_add=True) gender = db.StringProperty(required=True) name = db.StringProperty(required=True) user = db.UserProperty() mail = db.EmailProperty() phone = db.ListProperty(db.PhoneNumber) def gender_fmt(self): if len(self.gender)> 0: return self.gender[0].lower() else: return "" def is_male(self): if self.gender_fmt()[0] == "m": return True else: return False def is_female(self): if self.gender_fmt()[0] == "f": return True else: return False
class Profile(db.Model): account = db.ReferenceProperty(Account) name = db.StringProperty() author = db.EmailProperty() gh_token = db.StringProperty() created = db.DateTimeProperty(auto_now_add=True) updated = db.DateTimeProperty(auto_now=True)
class Member(User): phone_number = db.StringProperty() #phone number skype = db.StringProperty() identity_name = db.StringProperty() aiesec_email = db.EmailProperty() #verified aiesec email temp_email_code = db.StringProperty() home_committee = db.ReferenceProperty( Committee, collection_name='committee_reference_member') @staticmethod def GetMember(prop, value): member = Member.gql("WHERE :prop = :val", prop=prop, val=value) return member.get() def og_url(self): return "https://apps.facebook.com/iamanaiesecer/object_graph/member/{0}/".format( self.key()) def og_image(self): return "https://i-am-an-aiesecer.appspot.com/static/object_member.jpg" def experience(self): experience_list = [] experience_result = Experience.gql( "WHERE member = :1 AND approved = True", self.key()) for xp in experience_result: experience_list.append(xp) return experience_list def open_graph_object(self): path = os.path.join(os.path.dirname(__file__), 'object_member.html') return template.render(path, {"member": self})
class MetaData(db.Model): title = db.StringProperty(required=True) sub_title = db.StringProperty(required=True) adresse = db.PostalAddressProperty(required=True) contact = db.StringProperty(required=True) email1 = db.EmailProperty(required=True) email2 = db.EmailProperty(required=True) default_from_email = db.EmailProperty(required=True) domain = db.LinkProperty(required=True) domain_contrib = db.LinkProperty(required=True) phone = db.PhoneNumberProperty(required=True) online = db.BooleanProperty() dateonline = db.DateProperty(required=True, auto_now=True) def __unicode__(self): return u'Données globales : %s %s' % (self.title, self.domain)
class MyUser(db.Model): fullname = db.StringProperty() email = db.EmailProperty() username = db.StringProperty() password = db.StringProperty() session_id = db.StringProperty() active = db.BooleanProperty(default=False)
class User(JurisModel): """A user of this permiting application.""" # TODO: add authentication mechanisms / tokens # email works as the "primary key" to identify a user email = db.EmailProperty(required=True) # application logic ensures a role gets assigned when a new user logs in # for the first time, but the User object is first created w/o a role role = db.StringProperty(choices=USER_ROLES, required=False) def json(self): """Return JSON-serializable form.""" return {'cls': 'User', 'email': self.email, 'role': self.role} @classmethod def get_by_email(cls, email): return cls.all().filter('email = ', email).get() @property def can_upload(self): return self.role == 'Applicant' @property def can_approve(self): return self.role == 'Permit Approver' def __eq__(self, other): return other is not None and self.email == other.email def __ne__(self, other): return other is None or self.email != other.email
class Player(db.Model): """Object representing a player for Esri Hockey""" fname = db.StringProperty() lname = db.StringProperty() email = db.EmailProperty() goalie = db.BooleanProperty() inThisWeek = db.BooleanProperty() sub = db.BooleanProperty() team = db.StringProperty() phone = db.PhoneNumberProperty() def full_name(): return self.fname + " " + self.lname def toJson(self): json = {} json['fname'] = self.fname json['lname'] = self.lname json['email'] = self.email json['goalie'] = 'true' if self.goalie else 'false' json['inThisWeek'] = 'true' if self.inThisWeek else 'false' json['sub'] = 'true' if self.sub else 'false' json['team'] = self.team if self.team != "" else None json['phone'] = self.phone if self.phone else None return json
class MissingDataUsersSecondary(db.Model): email = db.EmailProperty(required=True) # amountCents never needs to be recomputed. The only way it can # change is to go up, and if it does, it means the user pledged # again, so they must have filled in their missing data. amountCents = db.IntegerProperty(required=True)
class Publisher(db.Model): username = db.StringProperty(required=True) password = db.StringProperty(required=True) name = db.StringProperty() lastname = db.StringProperty() email = db.EmailProperty() @classmethod def by_id(cls, uid): return Publisher.get_by_id(uid) @classmethod def by_username(cls, username): u = Publisher.all().filter('username =', username.lower()).get() return u @classmethod def register(cls, username, password): pw_hash = secure.make_pw_hash(username.lower(), password) p = Publisher(username=username.lower(), password=pw_hash) return p @classmethod def login(cls, username, pw): u = cls.by_username(username) if u: if secure.valid_pw(u.username, pw, u.password): return u else: return -1 else: return -2
class Job(db.Model): Email = db.EmailProperty() StartDate = db.DateTimeProperty() EndDate = db.DateTimeProperty() Service_Type = db.StringProperty() Description = db.StringProperty() postalCode = db.IntegerProperty()
class AllPropertiesModel(db.Model): """Property names are ugly, yes.""" prop_string = db.StringProperty() prop_byte_string = db.ByteStringProperty() prop_boolean = db.BooleanProperty() prop_integer = db.IntegerProperty() prop_float = db.FloatProperty() prop_date_time = db.DateTimeProperty() prop_date = db.DateProperty() prop_time = db.TimeProperty() prop_list = db.ListProperty(int) prop_string_list = db.StringListProperty() prop_reference = db.ReferenceProperty() prop_self_refeference = db.SelfReferenceProperty() prop_user = db.UserProperty() prop_blob = db.BlobProperty() prop_text = db.TextProperty() prop_category = db.CategoryProperty() prop_link = db.LinkProperty() prop_email = db.EmailProperty() prop_geo_pt = db.GeoPtProperty() prop_im = db.IMProperty() prop_phone_number = db.PhoneNumberProperty() prop_postal_address = db.PostalAddressProperty() prop_rating = db.RatingProperty()
class user(db.Model): email = db.EmailProperty() username = db.StringProperty() password = db.StringProperty() session_id = db.StringProperty() activated = db.BooleanProperty(default=False) activation_code = db.StringProperty(default=str(uuid.uuid4()))
class Message(db.Model): """A copy of a message sent out in email. This is a descendant of an Issue. """ issue = db.ReferenceProperty(Issue) # == parent subject = db.StringProperty() sender = db.EmailProperty() recipients = db.ListProperty(db.Email) date = db.DateTimeProperty(auto_now_add=True) text = db.TextProperty() draft = db.BooleanProperty(default=False) _approval = None @property def approval(self): """Is True when the message represents an approval of the review.""" if self._approval is None: # Must contain 'lgtm' in a line that doesn't start with '>'. self._approval = any( True for line in self.text.lower().splitlines() if not line.strip().startswith('>') and 'lgtm' in line) # Must not be issue owner. self._approval &= self.issue.owner.email() != self.sender return self._approval
class Candidate(db.Model): candidateId = db.StringProperty(required=True) name = db.StringProperty() date = db.DateProperty() email = db.EmailProperty() resumelink = db.LinkProperty() status = db.StringProperty()
class Booking(db.Model): booking_reference = db.StringProperty(required=True) property = db.StringProperty(required=True) first_name = db.StringProperty(required=True) last_name = db.StringProperty(required=True) email = db.EmailProperty(required=True) phone = db.PhoneNumberProperty(required=True) notes = db.TextProperty(required=False) booking_date = db.DateTimeProperty(auto_now_add=True) source = db.StringProperty(required=True) arrival_date = db.DateProperty(required=True) departure_date = db.DateProperty(required=True) number_of_people = db.IntegerProperty(required=True) gross = db.FloatProperty(required=True) is_discount = db.BooleanProperty(required=True) commission = db.FloatProperty(required=True) due_date = db.DateProperty(required=True) is_commission = db.BooleanProperty(required=True) is_greeting = db.FloatProperty(required=True) is_laundry = db.FloatProperty(required=True) is_cleaning = db.FloatProperty(required=True) is_con = db.FloatProperty(required=True) net = db.FloatProperty(required=True) # TODO: Change the below to required=True booking_fee = db.FloatProperty(required=False) house_owner_fee = db.FloatProperty(required=False) total_fees = db.FloatProperty(required=False) owner_income = db.FloatProperty(required=False)