-
默認情況下,這設置為
False
。當False
時,存儲來自重複字段的每個值。當設置為True
時,任何空白的尾隨值都將從結果中刪除。如果基礎字段具有required=True
,但remove_trailing_nulls
是True
,則空值僅允許在末尾,並將被剝離。一些例子:
SplitArrayField(IntegerField(required=True), size=3, remove_trailing_nulls=False) ['1', '2', '3'] # -> [1, 2, 3] ['1', '2', ''] # -> ValidationError - third entry required. ['1', '', '3'] # -> ValidationError - second entry required. ['', '2', ''] # -> ValidationError - first and third entries required. SplitArrayField(IntegerField(required=False), size=3, remove_trailing_nulls=False) ['1', '2', '3'] # -> [1, 2, 3] ['1', '2', ''] # -> [1, 2, None] ['1', '', '3'] # -> [1, None, 3] ['', '2', ''] # -> [None, 2, None] SplitArrayField(IntegerField(required=True), size=3, remove_trailing_nulls=True) ['1', '2', '3'] # -> [1, 2, 3] ['1', '2', ''] # -> [1, 2] ['1', '', '3'] # -> ValidationError - second entry required. ['', '2', ''] # -> ValidationError - first entry required. SplitArrayField(IntegerField(required=False), size=3, remove_trailing_nulls=True) ['1', '2', '3'] # -> [1, 2, 3] ['1', '2', ''] # -> [1, 2] ['1', '', '3'] # -> [1, None, 3] ['', '2', ''] # -> [None, 2]
本文介紹django.contrib.postgres.forms.SplitArrayField.remove_trailing_nulls
的用法。
聲明
remove_trailing_nulls
相關用法
- Python Django SpatialReference用法及代碼示例
- Python Django SpatialReference.__getitem__用法及代碼示例
- Python Scipy integrate.quadrature()用法及代碼示例
- Python Scipy stats.hypsecant.moment()用法及代碼示例
- Python String Center()用法及代碼示例
- Python Django SimpleTestCase.client用法及代碼示例
- Python Django Signal用法及代碼示例
- Python Scipy stats.hypsecant.median()用法及代碼示例
- Python Sympy Ellipse.equation()用法及代碼示例
- Python String decode()用法及代碼示例
- Python String轉Binary用法及代碼示例
- Python String count()用法及代碼示例
- Python Scipy stats.halfgennorm.fit()用法及代碼示例
- Python Tableau Server用法及代碼示例
- Python Sympy encloses_point()用法及代碼示例
- Python String join()用法及代碼示例
- Python String casefold()用法及代碼示例
- Python Scipy stats.halfgennorm.stats()用法及代碼示例
- Python Set issubset()用法及代碼示例
- Python Sympy Plane.perpendicular_plane()用法及代碼示例
- Python Scipy stats.halfgennorm.moment()用法及代碼示例
- Python Scipy stats.halfgennorm.std()用法及代碼示例
- Python Scipy stats.halfgennorm.logcdf()用法及代碼示例
- Python String轉Long用法及代碼示例
- Python Django SearchHeadline用法及代碼示例
注:本文由純淨天空篩選整理自djangoproject.com大神的英文原創作品 django.contrib.postgres.forms.SplitArrayField.remove_trailing_nulls。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。