Reputation: 47
Is there any way to change the way objects are named in Django Admin page. Currently all of the objects are using a TABLE Object(id) as their name:
Can i make it for example a key form the table like a name or smth. And is there any way to add search bar that goes over the names of the items in the table to filter it by that name.
Upvotes: 1
Views: 1910
Reputation: 146
Try this inside your model:
def __str__(self):
return self.name # this 'name' field must be exist in your model.
For search bar and other things you should read django documentation below:
https://docs.djangoproject.com/en/3.1/ref/contrib/admin/
Upvotes: 3