当前位置: 首页>>代码示例>>Python>>正文


Python Page.form方法代码示例

本文整理汇总了Python中page.Page.form方法的典型用法代码示例。如果您正苦于以下问题:Python Page.form方法的具体用法?Python Page.form怎么用?Python Page.form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在page.Page的用法示例。


在下文中一共展示了Page.form方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Storage

# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import form [as 别名]
def Storage(params=None):
    handle_params(params)

    data = []
    with pg_connection(*current_user.get_config()) as (con, cur, err):
        with pg_log_err('list storage query'):
            cur.execute(query('list-storage'))
            data = cur.fetchall()

    display_schemas = params.getlist('schema')
    schemas = set()
    treemap_data = {'name': 'root', 'children': []}
    for (schema_name, table_name, t_size, t_tuples) in data:
        schemas.add(schema_name)
        if schema_name in display_schemas or len(display_schemas) == 0:
            treemap_data['children'].append({'schema_name': schema_name, 'name': table_name,
                                             'size': int(t_size), 'rows': int(t_tuples)})

    p = Page()

    # Header
    p.add_page(Header(title='Storage',
                      js=['static/pages/storage.js',
                          'static/lib/d3/d3.js',
                          'static/lib/d3/lib/colorbrewer/colorbrewer.js'],
                      css=['static/pages/storage.css']))
    p.add_page(Navigation(page='storage'))
    with p.div({'class': 'container-fluid'}):
        with p.div({'class': 'row form-row'}):
            with p.div({'class': 'col-md-10'}):
                with p.form({'id': 'schema-form', 'class': 'form-inline'}):
                    for schema in schemas:
                        with p.label({'class': 'checkbox-inline'}):
                            checked = (schema in display_schemas or len(display_schemas) == 0) and 'checked' or ''
                            with p.input({'type': 'checkbox', 'name': 'schema', 'value': '%s' % schema}, args=[checked]):
                                p.content(schema)

            with p.div({'class': 'col-md-2'}):
                with p.form({'id': 'mode-form', 'class': 'form-inline'}):
                    with p.label({'class': 'radio-inline'}):
                        with p.input({'type': 'radio', 'name': 'mode', 'value': 'size'}, args=['checked']):
                            p.content('Size')
                    with p.label({'class': 'radio-inline'}):
                        with p.input({'type': 'radio', 'name': 'mode', 'value': 'rows'}):
                            p.content('Rows (est.)')

        with p.div({'class': 'row'}):
            with p.div({'class': 'col-md-12'}):
                with p.div({'id': 'treemap-chart'}): pass
                with p.script():
                    p.content('PGUI.STORAGE.mk_treemap_chart(%s);' % json.dumps(treemap_data))

    p.add_page(Footer())

    return p
开发者ID:crst,项目名称:pgui,代码行数:57,代码来源:storage.py

示例2: get

# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import form [as 别名]
    def get(self):
        #import page
        page = Page()

        #airJordan Shoe Instance

        airj = Shoe()
        airj.name = 'Air Jordans'
        airj.price = 180 #$
        airj.limit = 2 #pairs
        airj.img ="http://upload.wikimedia.org/wikipedia/en/3/37/Jumpman_logo.svg"

        #nikeFoampositePro Shoe Instance

        nfp = Shoe()
        nfp.name = 'Nike Foamposite Pro'
        nfp.price = 220 #$
        nfp.limit = 1 #pairs
        nfp.img = "http://upload.wikimedia.org/wikipedia/en/3/37/Jumpman_logo.svg"

        #nikeFoampositeOne Shoe Instance

        nfo = Shoe()
        nfo.name = 'Nike Foamposite One'
        nfo.price = 220 #$
        nfo.limit = 1 #pairs
        nfo.img ="http://upload.wikimedia.org/wikipedia/en/3/37/Jumpman_logo.svg"

        #lebron Shoe Instance

        leb = Shoe()
        leb.name = 'LeBrons'
        leb.price = 200 #$
        leb.limit = 1 #pairs
        leb.img ="http://upload.wikimedia.org/wikipedia/en/3/37/Jumpman_logo.svg"


        #kobe Shoe Instance

        kobe = Shoe()
        kobe.name = 'Kobes'
        kobe.price = 120 #$
        kobe.limit = 4 #pairs
        kobe.img ="http://upload.wikimedia.org/wikipedia/en/3/37/Jumpman_logo.svg"

        shoes = [
            airj,nfp,nfo,leb,kobe
        ]

        #HTML
        self.response.write(page.header())
        self.response.write(page.form())
        if self.request.GET:
            heat = (int(self.request.GET['heat']))-1
            print heat
            self.response.write(self.html(shoes[heat]))
        self.response.write(page.footer())
开发者ID:LyteiaHF1,项目名称:DPW_Kitchen_Lyteia,代码行数:59,代码来源:main.py

示例3: get

# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import form [as 别名]
    def get(self):
        #import page
        page = Page()
        #Grape Fruit Instance

        gfruit = List()
        gfruit.name = 'Grape Fruit'
        gfruit.price =  1.26#$
        gfruit.need = 1 #bag
        gfruit.img ="http://upload.wikimedia.org/wikipedia/en/e/e6/PT-Test.jpg"

        #Protein Powder Instance

        proteinp = List()
        proteinp.name = 'Protein Powder'
        proteinp.price = 15 #$
        proteinp.need = 1 #Container
        proteinp.img = "http://upload.wikimedia.org/wikipedia/en/e/e6/PT-Test.jpg"

        #Whole Wheat Bread Instance

        wwb = List()
        wwb.name = 'Whole Wheat Bread'
        wwb.price = 1.50 #$
        wwb.need = 2 #loaf
        wwb.img ="http://upload.wikimedia.org/wikipedia/en/e/e6/PT-Test.jpg"

        #Eggs Instance

        eggs = List()
        eggs.name = 'Eggs'
        eggs.price = 1 #$
        eggs.need = 1 #carton
        eggs.img ="http://upload.wikimedia.org/wikipedia/en/e/e6/PT-Test.jpg"

         #Water Instance

        water = List()
        water.name = 'Water'
        water.price =  5 #$
        water.need = 1 #cases 24 pack
        water.img ="http://upload.wikimedia.org/wikipedia/en/e/e6/PT-Test.jpg"

         #Grocery List Items Array
        glist = [
            gfruit,proteinp,wwb,eggs,water
        ]

        #HTML
        self.response.write(page.header())
        self.response.write(page.form())
        if self.request.GET:
            shop = (int(self.request.GET['shop']))-1
            print shop
            self.response.write(self.html(glist[shop]))
        self.response.write(page.footer())
开发者ID:LyteiaHF1,项目名称:DPW,代码行数:58,代码来源:main.py

示例4: get

# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import form [as 别名]
    def get(self):
        p = Page()

        ji = FamilyMember()
        ji.name = "Jason"
        ji.status = "father"
        ji.water_morning = 50
        ji.water_afternoon = 30
        ji.water_evening = 30

        ka = FamilyMember()
        ka.name = "Katie"
        ka.status = "mother"
        ka.water_morning = 30
        ka.water_afternoon = 30
        ka.water_evening = 20

        ij = FamilyMember()
        ij.name = "Isaac"
        ij.status = "son"
        ij.water_morning = 20
        ij.water_afternoon = 20
        ij.water_evening = 40

        ea = FamilyMember()
        ea.name = "Ella"
        ea.status = "daughter"
        ea.water_morning = 10
        ea.water_afternoon = 20
        ea.water_evening = 20

        ch = FamilyMember()
        ch.name = "Chewie"
        ch.status = "dog1"
        ch.water_morning = 3
        ch.water_afternoon = 4
        ch.water_evening = 2

        ot = FamilyMember()
        ot.name = "Otis"
        ot.status = "dog2"
        ot.water_morning = 4
        ot.water_afternoon = 4
        ot.water_evening = 3

        members = [ji, ka, ij, ea, ch, ot]

        self.response.write(p.header())
        self.response.write(p.form())

        if self.request.GET:
            member = (int(self.request.GET['member']))-1
            print member
            self.response.write(self.html(members[member]))
        self.response.write(p.footer())
开发者ID:jasonis,项目名称:DPfWP,代码行数:57,代码来源:main.py

示例5: Login

# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import form [as 别名]
def Login(params=None, title=None):
    """
    Renders the login page.

    There is no separate login for the application, this is passed to
    the database!
    """
    p = Page()
    p.content('<!DOCTYPE html>')
    with p.html():
        with p.head():
            with p.title():
                p.content('pgui - Login')
            with p.link({'href': 'static/lib/bootstrap/bootstrap-3.3.4-dist/css/bootstrap.css', 'rel': 'stylesheet'}): pass
            with p.link({'href': 'static/login.css', 'rel': 'stylesheet'}): pass

        with p.body():

            with p.div({'class': 'container'}):
                with p.form({'method': 'POST', 'class': 'login'}):
                    with p.h2({'class': 'login-header'}):
                        p.content('Connect to a postgres database server')

                    with p.label({'for': 'name', 'class': 'sr-only'}):
                        p.content('User name')
                    with p.input({'type': 'input', 'id': 'name', 'name': 'name', 'class': 'form-control', 'placeholder': 'User name'}): pass

                    with p.label({'for': 'password', 'class': 'sr-only'}):
                        p.content('Password')
                    with p.input({'type': 'password', 'id': 'password', 'name': 'password', 'class': 'form-control', 'placeholder': 'Password'}): pass

                    with p.label({'for': 'host', 'class': 'sr-only'}):
                        p.control('Host')
                    with p.input({'type': 'input', 'id': 'host', 'name': 'host', 'class': 'form-control', 'value': 'localhost'}): pass

                    with p.label({'for': 'port', 'class': 'sr-only'}):
                        p.content('Port')
                    with p.input({'type': 'input', 'id': 'port', 'name': 'port', 'class': 'form-control', 'value': '5432'}): pass

                    with p.button({'class': 'btn btn-lg btn-success btn-block', 'type': 'submit'}, args=['autofocus']):
                        p.content('Connect')


                with p.div({'class': 'login'}):
                    if 'err' in params and params['err']:
                        for err in params['err']:
                            with p.code():
                                p.content(err)

    return p
开发者ID:crst,项目名称:pgui,代码行数:52,代码来源:index.py

示例6: get

# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import form [as 别名]
	def get(self):
		page = Page() # creates an instance of the Page function which is defined at library.py

		mike = Person(5555) # Password for his/her voicemail
		mike.name = "Mike Taatgen" # Name of the user
		mike.text = 45 #Amount of text send
		mike.minutes = 300 # Amount of minutes talked on the phone
		mike.internet =  2 # Amount of GB used for data

		anthony = Person(5235) # Password for his/her voicemail
		anthony.name = "Anthony Kluba" # Name of the user
		anthony.text = 25 #Amount of text send
		anthony.minutes = 325 # Amount of minutes talked on the phone
		anthony.internet = 7.2 # Amount of GB used for data

		nate = Person(1821) # Password for his/her voicemail
		nate.name = "Nathan Dickison" # Name of the user
		nate.text = 75 #Amount of text send
		nate.minutes = 290 # Amount of minutes talked on the phone
		nate.internet = 3.2 # Amount of GB used for data

		jairo = Person(8371) # Password for his/her voicemail
		jairo.name = "Jairo Jurado" # Name of the user
		jairo.text = 25 #Amount of text send
		jairo.minutes = 400 # Amount of minutes talked on the phone
		jairo.internet =  6 # Amount of GB used for data

		rebecca = Person(9213) # Password for his/her voicemail
		rebecca.name = "Rebecca Carroll" # Name of the user
		rebecca.text = 49 #Amount of text send
		rebecca.minutes = 280 # Amount of minutes talked on the phone
		rebecca.internet = 4 # Amount of GB used for data

		players = [mike,anthony,nate,jairo,rebecca]	#array with all the players

		self.response.write(page.header()) # Creates the HTML attributes
		self.response.write(page.form())
		if self.request.GET:
			player = int(self.request.GET['person'])-1 #because index start at 0 
			self.response.write(self.html(players[player]))
		self.response.write(page.footer())
开发者ID:bogoroh,项目名称:DPW2,代码行数:43,代码来源:main.py


注:本文中的page.Page.form方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。