On Saturday, March 05, 2011 07:19:23 am Bobby Roberts wrote: > hi all... i'm banging my head against a wall here. > > consider this model > > class mymodel(models.Model): > id = models.AutoField (primary_key=True) > Barcode = models.IntegerField(unique = True, blank=False) > CustomerId= models.ForeignKey(Customer, db_index=True, > blank=True, null = True) > > > Now in the admin list view, we are able to pull back > Customer.FirstName and Customer.Lastname in the list fields. > > How would i search mymodel from admin on Customer.FirstName or > Customer.LastName?
CustomerId__LastName CustomerId__FirstName In the admin docs l;inked[1] below, search for "ModelAdmin.search_fields" It's about 40% down the page. the double underscore ('__') pretty much is universal when querying for a field in a related object in a model. Mike [1] http://docs.djangoproject.com/en/1.2/ref/contrib/admin/ -- Angels we have heard on High Tell us to go out and Buy. -- Tom Lehrer -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.