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


Python forms.SplitDateTimeWidget方法代碼示例

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


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

示例1: __init__

# 需要導入模塊: from django import forms [as 別名]
# 或者: from django.forms import SplitDateTimeWidget [as 別名]
def __init__(self, attrs=None):
        widgets = [AdminDateWidget, AdminTimeWidget]
        # Note that we're calling MultiWidget, not SplitDateTimeWidget, because
        # we want to define widgets.
        forms.MultiWidget.__init__(self, widgets, attrs) 
開發者ID:stormsha,項目名稱:StormOnline,代碼行數:7,代碼來源:widgets.py

示例2: test_constructor_attrs

# 需要導入模塊: from django import forms [as 別名]
# 或者: from django.forms import SplitDateTimeWidget [as 別名]
def test_constructor_attrs(self):
        widget = SplitDateTimeWidget(attrs={'class': 'pretty'})
        self.check_html(widget, 'date', datetime(2006, 1, 10, 7, 30), html=(
            '<input type="text" class="pretty" value="2006-01-10" name="date_0">'
            '<input type="text" class="pretty" value="07:30:00" name="date_1">'
        )) 
開發者ID:nesdis,項目名稱:djongo,代碼行數:8,代碼來源:test_splitdatetimewidget.py

示例3: test_constructor_different_attrs

# 需要導入模塊: from django import forms [as 別名]
# 或者: from django.forms import SplitDateTimeWidget [as 別名]
def test_constructor_different_attrs(self):
        html = (
            '<input type="text" class="foo" value="2006-01-10" name="date_0">'
            '<input type="text" class="bar" value="07:30:00" name="date_1">'
        )
        widget = SplitDateTimeWidget(date_attrs={'class': 'foo'}, time_attrs={'class': 'bar'})
        self.check_html(widget, 'date', datetime(2006, 1, 10, 7, 30), html=html)
        widget = SplitDateTimeWidget(date_attrs={'class': 'foo'}, attrs={'class': 'bar'})
        self.check_html(widget, 'date', datetime(2006, 1, 10, 7, 30), html=html)
        widget = SplitDateTimeWidget(time_attrs={'class': 'bar'}, attrs={'class': 'foo'})
        self.check_html(widget, 'date', datetime(2006, 1, 10, 7, 30), html=html) 
開發者ID:nesdis,項目名稱:djongo,代碼行數:13,代碼來源:test_splitdatetimewidget.py

示例4: test_formatting

# 需要導入模塊: from django import forms [as 別名]
# 或者: from django.forms import SplitDateTimeWidget [as 別名]
def test_formatting(self):
        """
        Use 'date_format' and 'time_format' to change the way a value is
        displayed.
        """
        widget = SplitDateTimeWidget(
            date_format='%d/%m/%Y', time_format='%H:%M',
        )
        self.check_html(widget, 'date', datetime(2006, 1, 10, 7, 30), html=(
            '<input type="text" name="date_0" value="10/01/2006">'
            '<input type="text" name="date_1" value="07:30">'
        )) 
開發者ID:nesdis,項目名稱:djongo,代碼行數:14,代碼來源:test_splitdatetimewidget.py


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