KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
My model looks like this: class Asset(models.Model): serial_number = models.CharField(max_length=100, unique=True) asset_tag = models.CharField(max_length=100, unique=True) class WorkOrder(models.Model): asset = models.ForeignKey(Asset) Essentially, a work order is submitted and then an admin assigns an asset to the work order. The asset_tag field is a barcode that we can scan in. When editing the work order in the Django admin, by default the asset field is displayed as a <select> widget. What we want to be able to do is have a search field so that we can scan the asset tag and then search for the right asset in the DB to associate with the work order. I know you can customize the Django admin foreign key to a hard coded query, but I can't figure out how to get it so it does a search based on a field on the admin page.
Tags (comma-separated)
Save Edits
Cancel