Customize Django Object Names with __str__ Method Last Updated : 28 Oct, 2025 Comments Improve Suggest changes 12 Likes Like Report When Django model instances are created, they appear in the admin interface with generic labels like ModelName object (1). This default naming can make it difficult to identify specific records when multiple entries exist.Giving model instances clear, readable names makes them easier to identify and manage.Django uses a generic placeholder when no readable name is defined.Meaningful names help quickly identify records in the admin panel.Overriding the __str__() method in the model class defines how objects are displayed.Improves clarity and usability for developers and administrators.Example: Consider a project named 'geeksforgeeks' having an app named 'geeks'.In models.py: Python from django.db import models from django.db.models import Model # Create your models here. class GeeksModel(Model): geeks_field = models.CharField(max_length = 200) After creating this model, we need to run two commands in order to create Database for the same:Python manage.py makemigrationsPython manage.py migrateAfter migrations and creating an instance with "GfG is Best" as the geeks_field value, the admin will display it as GeeksModel object (1). This default label is not descriptive and makes it hard to identify the entry.To make objects more readable in the admin, add a __str__ method to the model. This method should return a descriptive string representing the object.In model.py: Python from django.db import models class GeeksModel(models.Model): geeks_field = models.CharField(max_length=200) def __str__(self): return self.geeks_field # Returns the value of geeks_field as the display name Creating an object with geeks_field = "GfG is Best" will display "GfG is Best" in the admin instead of the generic "GeeksModel object (1)". Create Quiz Comment N NaveenArora Follow 12 Improve N NaveenArora Follow 12 Improve Article Tags : Python Python Django Django-models Explore Python FundamentalsPython Introduction 2 min read Input and Output in Python 4 min read Python Variables 4 min read Python Operators 4 min read Python Keywords 2 min read Python Data Types 8 min read Conditional Statements in Python 3 min read Loops in Python - For, While and Nested Loops 5 min read Python Functions 5 min read Recursion in Python 4 min read Python Lambda Functions 5 min read Python Data StructuresPython String 5 min read Python Lists 4 min read Python Tuples 4 min read Python Dictionary 3 min read Python Sets 6 min read Python Arrays 7 min read List Comprehension in Python 4 min read Advanced PythonPython OOP Concepts 11 min read Python Exception Handling 5 min read File Handling in Python 4 min read Python Database Tutorial 4 min read Python MongoDB Tutorial 3 min read Python MySQL 9 min read Python Packages 10 min read Python Modules 3 min read Python DSA Libraries 15 min read List of Python GUI Library and Packages 3 min read Data Science with PythonNumPy Tutorial - Python Library 3 min read Pandas Tutorial 4 min read Matplotlib Tutorial 5 min read Python Seaborn Tutorial 3 min read StatsModel Library - Tutorial 3 min read Learning Model Building in Scikit-learn 6 min read TensorFlow Tutorial 2 min read PyTorch Tutorial 6 min read Web Development with PythonFlask Tutorial 8 min read Django Tutorial | Learn Django Framework 7 min read Django ORM - Inserting, Updating & Deleting Data 4 min read Templating With Jinja2 in Flask 6 min read Django Templates 5 min read Build a REST API using Flask - Python 3 min read Building a Simple API with Django REST Framework 3 min read Python PracticePython Quiz 1 min read Python Coding Practice 1 min read Python Interview Questions and Answers 15+ min read Like