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
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
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):
3 matches
Mail list logo