Commit 0a08ef79 authored by Joaquin Hermosisima's avatar Joaquin Hermosisima

edited admin.py

parent 06c05f6e
from django.contrib import admin from django.contrib import admin
from .models import Author, Book
# Register your models here. # Register your models here.
class AuthorAdmin(admin.ModelAdmin):
model = Author
list_display = ('first_name', 'last_name', 'age', 'nationality', 'bio')
fields = ('first_name', 'last_name', 'age', 'nationality', 'bio')
search_fields = ('first_name', 'last_name')
list_filter = ('last_name', )
class BooksAdmin(admin.ModelAdmin):
model = Book
list_display = ('title', 'author', 'publisher', 'year_published', 'ISBN', 'blurb')
fields = ('title', 'author', 'publisher', 'year_published', 'ISBN', 'blurb')
search_fields = ('title', 'author', 'publisher', 'year_published', 'ISBN')
list_filter = ('title',)
admin.site.register(Author, AuthorAdmin)
admin.site.register(Book, BooksAdmin)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment