本文介紹 django.db.models.functions.Chr
的用法。
聲明
class Chr(expression, **extra)
接受數字字段或表達式,並將表達式的文本表示形式作為單個字符返回。它的工作原理與 Python 的
函數相同。chr()
像
一樣,它可以注冊為 Length
IntegerField
上的變換。默認查找名稱是 chr
。
使用示例:
>>> from django.db.models.functions import Chr
>>> Author.objects.create(name='Margaret Smith')
>>> author = Author.objects.filter(name__startswith=Chr(ord('M'))).get()
>>> print(author.name)
Margaret Smith
相關用法
- Python Django CheckboxSelectMultiple用法及代碼示例
- Python Tableau CSVRequestOptions用法及代碼示例
- Python Django ContentTypeManager用法及代碼示例
- Python Calendar itermonthdays2()用法及代碼示例
- Python Condition release()用法及代碼示例
- Python Collections.UserString用法及代碼示例
- Python Calendar monthdatescalendar()用法及代碼示例
- Python Condition notify()用法及代碼示例
- Python CSV轉JSON用法及代碼示例
- Python Django ContextMixin.get_context_data用法及代碼示例
- Python Django CustomUserManager.create_user用法及代碼示例
- Python Condition wait()用法及代碼示例
- Python Django Coalesce用法及代碼示例
- Python Calendar itermonthdates()用法及代碼示例
- Python Calendar iterweekdays()用法及代碼示例
- Python Django Client用法及代碼示例
- Python Django CustomUserManager.create_superuser用法及代碼示例
- Python Django Cot用法及代碼示例
- Python Calendar monthdayscalendar()用法及代碼示例
- Python Django Client.get用法及代碼示例
- Python Calendar itermonthdays3()用法及代碼示例
- Python Django Ceil用法及代碼示例
- Python Sympy Curve.translate()用法及代碼示例
- Python Collections.UserDict用法及代碼示例
- Python Django CursorWrapper.callproc用法及代碼示例
注:本文由純淨天空篩選整理自djangoproject.com大神的英文原創作品 django.db.models.functions.Chr。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。