About Duck Typing in Django

Duck typing for Django models allows you to reuse the same templates or JavaScripts for different models.

For example, a method get_cover_image() might retrieve an avatar for an author, a first image from the gallery for a library, and a cover image for a book. Then you can create a common template for global search results.

Tips and Tricks Programming Development Django 4.2 Django 3.2 Django 2.2 Python 3