Пример #1
0
 class Event(orm.Table):
     location = orm.Foreign(City)
     start = orm.DateTime(default=datetime.now)
     end = orm.DateTime(blank=True)
     
     def __repr__(self):
         return "<Event: %s>"%(self.location)
 class Parade(orm.Table):
     location = orm.Foreign(Capital)
     start = orm.DateTime(default=datetime.now)
     end = orm.DateTime(blank=True)
     
     def __repr__(self):
         return "<Lecture: %s>"%(self.location)
Пример #3
0
class Account(orm.Table):   
    user = orm.Foreign(User)
    type = orm.String(choices=["Normal", "Special",], default="Normal")
    balance = orm.Float(blank=True)
    
    def __repr__(self):
        return "<Account: %s's %s>"%(self.user.firstName, self.type)
Пример #4
0
    class Parade(orm.Table):
        location = orm.Foreign(Capital)
        start = orm.DateTime(default=datetime.now)
        end = orm.DateTime(blank=True)

        def __repr__(self):
            return "<Parade: %d/%d/%d - %s>" % (
                self.start.year, self.start.month, self.start.day,
                self.location.name)