我的模式:
class Contact(models.Model):
first_name = models.CharField(_("First name"), max_length=30, )
last_name = models.CharField(_("Last name"), max_length=30, )
email = models.EmailField(_("Email"), blank=True, max_length=75)
class PhoneNumber(models.Model):
contact = models.ForeignKey(Contact)
phone = models.CharField(_("Phone Number"), blank=True, max_length=30, )
primary = models.BooleanField(_("Primary"), default=False)
我的行政:
class ContactOptions(AutocompleteAdmin):
list_display = ( last_name , first_name )
ordering = [ last_name ]
search_fields = ( first_name , last_name , email )
related_search_fields = { """??? I want to search the Phone Numbers ???""" }
如何在Django admin搜寻电话号码? 请提供一些法典。 非常感谢!