Re: Newbie question: can foreign key fields used as search fields on admin page?

2010-08-26 Thread Kenneth Gonsalves
On Wed, 2010-08-25 at 21:49 -0700, Joe Z wrote: > class BookAdmin(admin.ModelAdmin): > list_display = ('title', 'author', 'publisher') > search_fields = ('first_name', 'last_name') > > Is it possible to add 'publisher' into search_fields so that in admin > page books showed can be narrow

Re: Newbie question: can foreign key fields used as search fields on admin page?

2010-08-26 Thread Dennis Kaarsemaker
On wo, 2010-08-25 at 21:49 -0700, Joe Z wrote: > Is it possible to add 'publisher' into search_fields so that in admin > page books showed can be narrow down by a specific publisher? I tried > it but got the following exception: Not as such, but you can add publisher__name (assuming publisher

Newbie question: can foreign key fields used as search fields on admin page?

2010-08-25 Thread Joe Z
On http://www.djangobook.com/en/2.0/chapter06/ in models.py: class Book(models.Model): title = models.CharField(max_length=100) authors = models.ManyToManyField(Author) publisher = models.ForeignKey(Publisher) publication_date = models.DateField() def __unicode__(self):