# Python : Django : ORM : Models
## Fields
Note: All classes end with "Field".
```
Auto auto-incrementing Integer; usually don't need to use directly
(also: BigAuto, SmallAuto)
Binary
Boolean
Char max_length= (optional for Postgres)
Date auto_now=False (last-modified) auto-updated on save()
auto_now_add=False (first-created)
DateTime (same as Date)
Decimal decimal.Decimal, max_digits=None, decimal_places=None
Duration datetime.timedelta
Email Char + EmailValidator, max_length=254
File upload_to="", max_length=100, storage=None
Float float
Generated DB-computed field
GenericIPAddress
Image
Integer (BigInteger, SmallInteger, PositiveInteger, PositiveBigInteger, PositiveSmallInteger)
JSON encoder=None, decoder=None
Slug
Text
Time (same as Date)
URL Char + URLValidator, max_length=200
UUID uuid.UUID; to use as primary key:
UUIDField( primary_key=True, default=uuid.uuid4, editable=False )
```
## Field Attributes
```
blank = False if True, allow form field to be blank
choices = { VALUE: DISPLAY_NAME }
db_column = "..." defaults to field's name in Model class
db_default = Now() DB-computed value (literal or DB function)
default = val -or- callable() app-computed value
editable = True if False, validation skipped and hidden from ModelForms
null = False if True, store empty values as "NULL"
primary_key = True only allowed on one field; implies null=False and unique=True;
if not set on any field, a primary key will be automatically added
unique = False if True, an index will be created
```
## Type Mappings
```
Postgres Field Django Field Django Widget
────────────── ────────────── ──────────────────────
Boolean CheckboxInput
VARCHAR Char TextInput
Date DateInput
DateTime DateTimeInput -or- 2x TextInput (Admin)
Decimal NumberInput
interval Duration
Float NumberInput
Integer NumberInput
Text Textarea
Time TimeInput
URL URLInput
uuid UUID
```