from elixir import *
class Place(Entity):
title = Field(Unicode(50))
alias = Field(Unicode(20))
text = Field(UnicodeText)
types = OneToMany('PlaceTypes')
service = OneToMany('PlaceServices')
photo = Field(Unicode(30))
work_time = OneToMany('WorkTime')
city = OneToOne('City')
address = Field(Unicode(100))
def __repr__(self):
return self.title
class PlaceTypes(Entity):
alias = Field(Unicode(15))
title = Field(Unicode(50))
places = ManyToOne('Place')
def __repr__(self):
return self.title
class PlaceServices(Entity):
alias = Field(Unicode(15))
title = Field(Unicode(50))
places = ManyToOne('Place')
def __repr__(self):
return self.title
class WorkTime(Entity):
place = ManyToOne('Place')
day = Field(Unicode(30))
open_time = Field(Time)
close_time = Field(Time)
all_day = Field(Boolean)
def __repr__(self):
return self.day
class City(Entity):
alias = Field(Unicode(15))
name = Field(Unicode(30))
place = ManyToOne('Place')
def __repr__(self):
return self.name