Tuesday, 2 August 2022

django model db column field

 https://www.webforefront.com/django/modeldatatypesandvalidation.html


Data typeDjango model typeDatabase DDLDescription - Validation - Notes
SQLiteMySQLPostgreSQLOracle
Binarymodels.BinaryField()BLOB NOT NULLlongblob NOT NULLbytea NOT NULLBLOB NULLCreates a blob field to store binary data (e.g. images, audio or other multimedia objects)
Booleanmodels.BooleanField()bool NOT NULLbool NOT NULLboolean NOT NULLNUMBER(1) NOT NULL CHECK ("VAR" IN (0,1))Creates a boolean field to store True/False (or 0/1) values
Booleanmodels.NullBooleanField()bool NULLbool NULLboolean NULLNUMBER(1) NULL CHECK (("VAR" IN (0,1)) OR ("VAR" IS NULL))Works just like BooleanField but also allows NULL values
Date/timemodels.DateField()date NOT NULLdate NOT NULLdate NOT NULLDATE NOT NULLCreates a date field to store dates
Date/timemodels.TimeField()time NOT NULLtime NOT NULLtime NOT NULLTIMESTAMP NOT NULLCreates a ti

No comments:

Post a Comment