Home > Net >  Django search field in the database
Django search field in the database

Time:09-20

is it possible to change my display employe to a search block because when I select the numbers it displays a list which is not practical when I have a lot of numbers in my database.

add info to an existing employee

CodePudding user response:

You can define __str__() method for your Employee model, it result would be seen in admin dropdown

class Employee(models.Model):
    first_name = models.CharField(max_length=50)
    ...

    def __str__(self):
        return self.first_name

CodePudding user response:

Try select2 widget, this should be more than enough for you.

https://django-select2.readthedocs.io/en/latest/

  • Related