Commit cd42c299 authored by Jan Ericsson Ong Ang's avatar Jan Ericsson Ong Ang

made edits in admin.py

parent 522b9f3f
from django.contrib import admin from django.contrib import admin
from.models import Author, Books from .models import Author, Books
# Register your models here. # Register your models here.
class AuthorAdmin(admin.ModelAdmin): class AuthorAdmin(admin.ModelAdmin):
model = Author model = Author
list_display = ("first_name", "last_name", "age", "nationality", "bio",) list_display = ("first_name", "last_name", "age", "nationality", "bio",)
search_fields = ("last_name", "nationality",) search_fields = ("last_name", "nationality",)
list_filter = ("last_name", "nationality") list_filter = ("last_name", "nationality",)
class BooksAdmin(admin.ModelAdmin): class BooksAdmin(admin.ModelAdmin):
model = Books model = Books
list_display = ("title", "author", "publisher", "year_published", "ISBN", "blurb",) list_display = ("title", "author", "publisher", "year_published", "ISBN", "blurb",)
search_fields = ("title", "author", "publisher", "year_published", "ISBN",) search_fields = ("title", "author", "publisher", "year_published", "ISBN",)
list_filter = ("title", "author", "publisher", "year_published") list_filter = ("title", "author", "publisher", "year_published",)
admin.site.register(Author, AuthorAdmin) admin.site.register(Author, AuthorAdmin)
admin.site.register(Books, BooksAdmin) admin.site.register(Books, 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