文書の過去の版を表示しています。
Django リファレンス メモ
ユーザー API
モデル API
データ フィールド
フィールド型 | Python型 | PostgreSQL型 - サイズ,範囲 | SQLite型 - サイズ,範囲 | 説明 |
---|---|---|---|---|
AutoField | int | serial - 4 バイト, 1 〜 2147483647 | integer | 主キー用の自動的インクリメント IntegerField |
BigAutoField | int | bigserial | integer | 64 ビット数値。1 ~ 9223372036854775807 の自動的インクリメント BigIntegerField |
BigIntegerField | int | bigint - 8 バイト, -9223372036854775808 〜 922337203685477 | bigint | Big Integer フィールド IntegerField を継承 |
BinaryField | str(base64) | byte - 最大1G, 可変長バイナリ | BLOB | Raw バイナリーデーターフィールド |
BooleanField | bool | boolean - 真偽 (true/false) 値 | bool | 真偽 (true/false) 値を表すフィールド |
CharField | str | varchar(%(max_length)s) - 可変長文字列 | varchar(%(max_length)s) | 文字列フィールド |
DateField | datetime | date - 4バイト, 日付 | 日付フィールド | |
DateTimeField | datetime | timestamp with time zone − 8バイト, タイムゾーン付き年月日時分秒, 1マイクロ秒/14桁 | 日付と時刻のフィールド | |
DecimalField | Decimal | numeric(%(max_digits)s, %(decimal_places)s) - 無制限, 精度無制限 | 固定精度の 10 進小数フィールド | |
DurationField | timedelta | interval - 12バイト, 1マイクロ秒/14桁 | 日付や時刻の差を表すフィールド | |
EmailField | str | varchar(%(max_length)s) - 可変長文字列 | e-mail アドレスフィールド CharField 継承 |
|
FileField | str | varchar(%(max_length)s) - 可変長文字列 | ファイルアップロードフィールド | |
FieldFile | ||||
FilePathField | str | varchar(%(max_length)s) - 可変長文字列 | ファイルパスフィールド | |
FloatField | float | double precision - 8バイト, 浮動小数(有効桁15) | 浮動小数点フィールド | |
ImageField | str | varchar(%(max_length)s) - 可変長文字列 | イメージフィールド FileField 継承 |
|
IntegerField | int | integer - 4 バイト, -2147483648 〜 +2147483647 | 固定精度整数フィールド | |
NullBooleanField | bool | boolean 真偽 (true/false) 値 | Null と真偽 (true/false) 値を表すフィールド | |
PositiveIntegerField | int | integer - 4バイト, -2147483648 〜 +2147483647 | 正数(0 〜 2147483647) CHECK(“%(column)s” >= 0) IntegerField を継承 |
|
PositiveSmallIntegerField | int | smallint - 2バイト, -32768 〜 +32767 | 正数(0 〜 32767) CHECK(“%(column)s” >= 0) IntegerField を継承 |
|
SlugField | str | varchar(%(max_length)s) - 可変長文字列 | 内容を示す短いラベルフィールド | |
SmallIntegerField | int | smallint - 2バイト, -32768 〜 +32767 | 固定精度整数フィールド | |
TextField | str | text - 無制限, 可変長文字列 | 長いテキストフィールド | |
TimeField | datetime | time - 8バイト, タイムゾーンなし時刻 1マイクロ秒/14桁 | 時刻フィールド | |
URLField | str | varchar(%(max_length)s) - 可変長文字列 | URL を表す CharField 継承 |
|
UUIDField | UUID | uuid - 16バイト, uuid | ユニバーサルユニークIDフィールド(32文字) | |
| | | 1.8になし TextField 継承 |
|
| | | - | 1.9で廃止 IPv4アドレス |
| | | - | 1.9で廃止 IPv4/IPv6アドレス |
| | | - | 2.0で廃止 カンマで区切った整数からなるフィールド |
リレーション フィールド
フィールド型 | Python型 | PostgreSQL型 | 説明 |
---|---|---|---|
ForeignKey | int | ||
ManyToManyField | int | ||
OneToOneField(ForeignKey 継承) | int | integer |
参考文献
django/db/models/fields/__init__.py django/db/models/fields/files.py django/db/backends/postgresql_psycopg2/base.py
テンプレート API
テンプレート | Django ドキュメント | Django
組み込みタグ/フィルタリファレンス — Django 1.4 documentation
Python プログラマのための Django テンプレート言語ガイド — Django v1.4 documentation
テンプレートタグやフィルタを自作する — Django 1.4 documentation
参考文献
フォーム フィールド
フィールド型 | 説明 |
---|---|
BooleanField | |
CharField | |
ChoiceField | |
TypedChoiceField | |
DateField | |
DateTimeField | |
DecimalField | |
EmailField | |
FileField | |
FilePathField | |
FloatField | |
ImageField | |
IntegerField | |
IPAddressField | |
MultipleChoiceField | |
NullBooleanField | |
RegexField | |
TimeField | |
URLField | |
ComboField | |
MultiValueField | |
SplitDateTimeField | |
ModelChoiceField | |
ModelMultipleChoiceField |