Search code examples
djangodjango-modelsdjango-admin

how to use popup in django admin to select from another class


i want to use popup to fill input in django admin i saw it in class Email addresses as the follwing pic enter image description here

enter image description here

enter image description here


Solution

  • It's an attribute raw_id_fields that you can use while registering your models in the admin section. raw_id_fields = ('author',) Its use is that the author field is displayed with a lookup widget that can scale much better than a drop-down select input when you have thousands of users.

    example