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


Python HTML.td方法代碼示例

本文整理匯總了Python中webhelpers2.html.HTML.td方法的典型用法代碼示例。如果您正苦於以下問題:Python HTML.td方法的具體用法?Python HTML.td怎麽用?Python HTML.td使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在webhelpers2.html.HTML的用法示例。


在下文中一共展示了HTML.td方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: table_totals

# 需要導入模塊: from webhelpers2.html import HTML [as 別名]
# 或者: from webhelpers2.html.HTML import td [as 別名]
    def table_totals(self, rownum, record, label, numrecords):
        row_hah = self.table_tr_styler(rownum, record)
        row_hah.class_ += 'totals'

        # get the <td>s for this row
        cells = []
        colspan = 0
        firstcol = True
        for col in self.grid.iter_columns('html'):
            if col.key not in list(self.grid.subtotal_cols.keys()):
                if firstcol:
                    colspan += 1
                else:
                    cells.append(_HTML.td(literal('&nbsp;')))
                continue
            if firstcol:
                bufferval = ngettext('{label} ({num} record):',
                                     '{label} ({num} records):',
                                     numrecords,
                                     label=label)
                buffer_hah = HTMLAttributes(
                    colspan=colspan,
                    class_='totals-label'
                )
                if colspan:
                    cells.append(_HTML.td(bufferval, **buffer_hah))
                firstcol = False
                colspan = 0
            cells.append(self.table_td(col, record))

        return self.table_tr_output(cells, row_hah)
開發者ID:level12,項目名稱:webgrid,代碼行數:33,代碼來源:renderers.py

示例2: filtering_table_row

# 需要導入模塊: from webhelpers2.html import HTML [as 別名]
# 或者: from webhelpers2.html.HTML import td [as 別名]
 def filtering_table_row(self, col):
     extra = getattr(col.filter, 'html_extra', {})
     return _HTML.tr(
         _HTML.th(self.filtering_col_label(col), class_='filter-label')
         + _HTML.td(self.filtering_col_op_select(col), class_='operator')
         + _HTML.td(
             _HTML.div(self.filtering_col_inputs1(col), class_='inputs1')
             + _HTML.div(self.filtering_col_inputs2(col), class_='inputs2')
         ),
         # Added _filter to address CSS collision with Bootstrap
         # Ref: https://github.com/level12/webgrid/issues/28
         class_=col.key + '_filter',
         **extra
     )
開發者ID:level12,項目名稱:webgrid,代碼行數:16,代碼來源:renderers.py

示例3: options_td

# 需要導入模塊: from webhelpers2.html import HTML [as 別名]
# 或者: from webhelpers2.html.HTML import td [as 別名]
        def options_td(col_num, i, item):
            if item.owner is True:
                return HTML.td("", class_="c{}".format(col_num))

            href = self.request.route_url(
                "admin_object_relation",
                object="resources",
                object_id=item.resource.resource_id,
                verb="DELETE",
                relation="group_permissions",
                _query={"perm_name": item.perm_name, "group_id": item.group.id},
            )
            delete_link = HTML.a(
                translate(_("Delete")), class_="btn btn-danger", href=href
            )
            return HTML.td(delete_link, class_="c{}".format(col_num))
開發者ID:ergo,項目名稱:testscaffold,代碼行數:18,代碼來源:grids.py

示例4: table_td

# 需要導入模塊: from webhelpers2.html import HTML [as 別名]
# 或者: from webhelpers2.html.HTML import td [as 別名]
    def table_td(self, col, record):
        col_hah = HTMLAttributes(col.body.hah)

        # allow column stylers to set attributes
        for styler, cname in self.grid._colstylers:
            for_column = self.grid.column(cname)
            if col.key == for_column.key:
                styler(self.grid, col_hah, record)

        # extract the value from the record for this column and prep
        col_value = col.render('html', record, col_hah)

        # turn empty values into a non-breaking space so table cells don't
        # collapse
        if col_value is None:
            styled_value = literal('&nbsp;')
        elif isinstance(col_value, six.string_types) and col_value.strip() == '':
            styled_value = literal('&nbsp;')
        else:
            styled_value = col_value

        return _HTML.td(styled_value, **col_hah)
開發者ID:level12,項目名稱:webgrid,代碼行數:24,代碼來源:renderers.py

示例5: registered_date_td

# 需要導入模塊: from webhelpers2.html import HTML [as 別名]
# 或者: from webhelpers2.html.HTML import td [as 別名]
 def registered_date_td(col_num, i, item):
     return HTML.td(
         item.registered_date.strftime("%Y-%m-%d %H:%M"),
         class_="c{}".format(col_num),
     )
開發者ID:ergo,項目名稱:testscaffold,代碼行數:7,代碼來源:grids.py

示例6: translate_perm_td

# 需要導入模塊: from webhelpers2.html import HTML [as 別名]
# 或者: from webhelpers2.html.HTML import td [as 別名]
 def translate_perm_td(col_num, i, item):
     if getattr(item, "owner", None) is True:
         perm_name = translate(_("Resource owner"))
     else:
         perm_name = item.perm_name
     return HTML.td(perm_name, class_="c{}".format(col_num))
開發者ID:ergo,項目名稱:testscaffold,代碼行數:8,代碼來源:grids.py

示例7: group_td

# 需要導入模塊: from webhelpers2.html import HTML [as 別名]
# 或者: from webhelpers2.html.HTML import td [as 別名]
 def group_td(col_num, i, item):
     return HTML.td(item.group.group_name, class_="c{}".format(col_num))
開發者ID:ergo,項目名稱:testscaffold,代碼行數:4,代碼來源:grids.py

示例8: user_td

# 需要導入模塊: from webhelpers2.html import HTML [as 別名]
# 或者: from webhelpers2.html.HTML import td [as 別名]
 def user_td(col_num, i, item):
     return HTML.td(item.user.user_name, class_="c{}".format(col_num))
開發者ID:ergo,項目名稱:testscaffold,代碼行數:4,代碼來源:grids.py

示例9: options_td

# 需要導入模塊: from webhelpers2.html import HTML [as 別名]
# 或者: from webhelpers2.html.HTML import td [as 別名]
 def options_td(self, col_num, i, item):
     u = url(
         "/tickets/view", ticket_id=item.id, y=self.additional_kw["context"]["y"]
     )
     a = link_to(item.options, u)
     return HTML.td(a)
開發者ID:ergo,項目名稱:webhelpers_grid2,代碼行數:8,代碼來源:tests.py


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