本文整理汇总了Python中formalchemy.FieldSet.append方法的典型用法代码示例。如果您正苦于以下问题:Python FieldSet.append方法的具体用法?Python FieldSet.append怎么用?Python FieldSet.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类formalchemy.FieldSet
的用法示例。
在下文中一共展示了FieldSet.append方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FieldSet
# 需要导入模块: from formalchemy import FieldSet [as 别名]
# 或者: from formalchemy.FieldSet import append [as 别名]
('zoom', formalchemy_default_zoom),
('default_lon', formalchemy_default_x),
('default_lat', formalchemy_default_y)
])
fieldOrder = [Role.name,
Role.description,
Role.functionalities,
Role.restrictionareas,
Role.users,
Role.extent]
Role.configure(include=fieldOrder)
# User
User = FieldSet(models.User)
password = DblPasswordField(User, User._password)
User.append(password)
fieldOrder = [
User.username.validate(unique_validator).with_metadata(mandatory=''),
password,
User.role
]
if hasattr(User, 'parent_role'): # pragma: no cover
fieldOrder.append(User.parent_role)
fieldOrder.extend([
User.functionalities.set(renderer=FunctionalityCheckBoxTreeSet),
User.email.with_metadata(mandatory='')
])
User.configure(include=fieldOrder)
#############################################################################
# GRID defs
示例2: get_last_hotel_id
# 需要导入模块: from formalchemy import FieldSet [as 别名]
# 或者: from formalchemy.FieldSet import append [as 别名]
if d <= distance:
choosen[site] = d
return choosen
def get_last_hotel_id():
r = Session().query(Hotel.id).order_by(Hotel.id)[0][0]
print r
return r
#This function returns the last 5 hotels stored in the system
def get_last_hotels():
return Session().query(Hotel).all()[-5:]
#Hotel's FieldSet
HotelFieldSet = FieldSet(Hotel)
HotelFieldSet.append(Field(name='imagem').with_renderer(FileFieldRenderer))
HotelFieldSet.configure(
exclude=[HotelFieldSet.latitude,HotelFieldSet.longitude],
options=[HotelFieldSet.regiao.dropdown(options=HotelRegiao().get_values()),
HotelFieldSet.finalidade.dropdown(options=HotelFim().get_values()),
HotelFieldSet.tipo.dropdown(options=HotelTipo().get_values())])
#User's FieldSet
UserFieldSet = FieldSet(User)
UserFieldSet.insert_after(UserFieldSet.password, Field(name='password2').with_renderer(PasswordFieldRenderer))
UserFieldSet.append(Field(name='password').with_renderer(PasswordFieldRenderer))
UserFieldSet.append(Field('hotel_fim').dropdown(options=HotelFim().get_values()))
UserFieldSet.configure(exclude=[UserFieldSet.creation_date])
#TouristicSite's FieldSet
TouristicSiteFieldSet = FieldSet(TouristicSite)