https://www.webforefront.com/django/modeldatatypesandvalidation.html
| Data type | Django model type | Database DDL | Description - Validation - Notes | ||||
|---|---|---|---|---|---|---|---|
| SQLite | MySQL | PostgreSQL | Oracle | ||||
| Binary | models.BinaryField() | BLOB NOT NULL | longblob NOT NULL | bytea NOT NULL | BLOB NULL | Creates a blob field to store binary data (e.g. images, audio or other multimedia objects) | |
| Boolean | models.BooleanField() | bool NOT NULL | bool NOT NULL | boolean NOT NULL | NUMBER(1) NOT NULL CHECK ("VAR" IN (0,1)) | Creates a boolean field to store True/False (or 0/1) values | |
| Boolean | models.NullBooleanField() | bool NULL | bool NULL | boolean NULL | NUMBER(1) NULL CHECK (("VAR" IN (0,1)) OR ("VAR" IS NULL)) | Works just like BooleanField but also allows NULL values | |
| Date/time | models.DateField() | date NOT NULL | date NOT NULL | date NOT NULL | DATE NOT NULL | Creates a date field to store dates | |
| Date/time | models.TimeField() | time NOT NULL | time NOT NULL | time NOT NULL | TIMESTAMP NOT NULL | Creates a ti | |
No comments:
Post a Comment