Code-Memo

Model Fields

Common Model Fields

CharField
TextField
IntegerField, FloatField, DecimalField
BooleanField
DateField, DateTimeField

Note: auto_now_add automatically adds the date. If you want to change the timezone used by Django’s auto_now_add feature from UTC to another timezone, you need to configure Django’s timezone settings appropriately in your settings file (settings.py):

  1. Set Timezone in settings.py: Ensure your desired timezone is set in your Django project settings:

    TIME_ZONE = 'America/New_York'
    
  2. Enable Timezone Support: Ensure that Django’s timezone support is enabled by setting USE_TZ to True in your settings.py file:

    USE_TZ = True
    
FileField, ImageField
AutoField, BigAutoField
BigIntegerField
ForeignKey, OneToOneField, ManyToManyField