當前位置: 首頁>>代碼示例>>Python>>正文


Python FieldSet.append方法代碼示例

本文整理匯總了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
開發者ID:CDTRH,項目名稱:c2cgeoportal,代碼行數:33,代碼來源:forms.py

示例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)
開發者ID:casimiro,項目名稱:albergue-amigo,代碼行數:33,代碼來源:models.py


注:本文中的formalchemy.FieldSet.append方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。