What is the related_name attribute on a relationship field, and how does it affect reverse lookups?

Last updated 17 June 2026

  • related_name sets the reverse accessor from the target model back to the model defining the FK/M2M, replacing the default <model>_set (e.g. author.books instead of author.book_set).

  • Distinct names resolve clashes when two FKs point to the same model. Setting related_name="+" disables the reverse relation.

  • The name is also used in reverse query filters like books__title, unless overridden by related_query_name.

  • https://www.geeksforgeeks.org/python/crud-operation-on-a-django-model-with-a-many-to-many-field/
  • https://www.geeksforgeeks.org/python/how-to-express-a-one-to-many-relationship-in-django/
  • https://www.geeksforgeeks.org/python/include-related-model-fields-in-django-rest-framework/
  • https://www.geeksforgeeks.org/python/the-most-efficient-way-to-store-a-list-in-django-models/
  • https://www.geeksforgeeks.org/python/quiz-application-using-django/
  • https://www.geeksforgeeks.org/python/best-practices-for-professional-developer-django-framework/
  • https://dev.to/guzmanojero/understanding-relatedname-in-django-with-clear-examples-2em5
All Django interview questions