How and when to use GenericForeignKey in Django?

Photo by Jaye Haych on Unsplash
INSTALLED_APPS = [
# other installed apps
'django.contrib.contenttypes', # -> make sure you have this
]

If you want to have an activity log.

If you have common fields in different models.

profile = Profile.objects.first()# you cannot do this
Address.objects.filter(content_object=profile)
# as well you cannot do this
Address.objects.get(content_object=profile)

References:

I’m a software engineer with a passion to learn new technology that interests me.