# Django imports
from django.contrib import admin
# Internal imports
from .models import Book, Chapter
# External imports

# * Class for displaying chapters inside of the book entry, in TabularInLine form
class ChapterInline(admin.TabularInline):
    model = Chapter
    extra = 1 # Just one block of new chapter offered by default

# * Class defining the model Book for the admin
class BookAdmin(admin.ModelAdmin):
    # Defining what and how things will be shown in the specific table of a Book
    fieldsets = [
        ('GENERAL BOOK INFO',      {'fields': ['title','long_description','short_description']}),
        ('PUBLISHING INFORMATION', {'fields': ['published_at'], 'classes': ['collapse']}),
    ]
    inlines = [ChapterInline] # Adds the class ChapterInLine to the specific table of a Book
    list_display = ('title', 'created_at', 'published_at', 'was_published_recently', 'get_absolute_url') # Defines values shown in the general table
    list_filter = ['created_at', 'published_at'] # Defines filters to be shown in the general table
    search_fields = ['title'] # Defines the search box of the general table

# * Class defining the model Chapter for the admin
class ChapterAdmin(admin.ModelAdmin):
    # Defining what and how things will be shown in the specific table of a Chapter
    fieldsets = [
        ('GENERAL CHAPTER INFO',      {'fields': ['book', 'name', 'content']}),
        ('PUBLISHING INFORMATION', {'fields': ['published_at'], 'classes': ['collapse']}),
        ('SCORE INFORMATION', {'fields': ['score']}),
    ]
    list_display = ('name', 'book', 'created_at', 'published_at', 'was_published_recently', 'get_absolute_url') # Defines values shown in the general table
    list_filter = ['created_at', 'published_at'] # Defines filters to be shown in the general table
    search_fields = ['name'] # Defines the search box of the general table

# * Registering the models to the admin page
admin.site.register(Book, BookAdmin)
admin.site.register(Chapter, ChapterAdmin)
8075ee0115731afe374a723b753b05d9f7880672
<mask token>


class ChapterInline(admin.TabularInline):
    <mask token>
    <mask token>


class BookAdmin(admin.ModelAdmin):
    fieldsets = [('GENERAL BOOK INFO', {'fields': ['title',
        'long_description', 'short_description']}), (
        'PUBLISHING INFORMATION', {'fields': ['published_at'], 'classes': [
        'collapse']})]
    inlines = [ChapterInline]
    list_display = ('title', 'created_at', 'published_at',
        'was_published_recently', 'get_absolute_url')
    list_filter = ['created_at', 'published_at']
    search_fields = ['title']


class ChapterAdmin(admin.ModelAdmin):
    fieldsets = [('GENERAL CHAPTER INFO', {'fields': ['book', 'name',
        'content']}), ('PUBLISHING INFORMATION', {'fields': ['published_at'
        ], 'classes': ['collapse']}), ('SCORE INFORMATION', {'fields': [
        'score']})]
    list_display = ('name', 'book', 'created_at', 'published_at',
        'was_published_recently', 'get_absolute_url')
    list_filter = ['created_at', 'published_at']
    search_fields = ['name']


<mask token>

<mask token>


class ChapterInline(admin.TabularInline):
    model = Chapter
    extra = 1


class BookAdmin(admin.ModelAdmin):
    fieldsets = [('GENERAL BOOK INFO', {'fields': ['title',
        'long_description', 'short_description']}), (
        'PUBLISHING INFORMATION', {'fields': ['published_at'], 'classes': [
        'collapse']})]
    inlines = [ChapterInline]
    list_display = ('title', 'created_at', 'published_at',
        'was_published_recently', 'get_absolute_url')
    list_filter = ['created_at', 'published_at']
    search_fields = ['title']


class ChapterAdmin(admin.ModelAdmin):
    fieldsets = [('GENERAL CHAPTER INFO', {'fields': ['book', 'name',
        'content']}), ('PUBLISHING INFORMATION', {'fields': ['published_at'
        ], 'classes': ['collapse']}), ('SCORE INFORMATION', {'fields': [
        'score']})]
    list_display = ('name', 'book', 'created_at', 'published_at',
        'was_published_recently', 'get_absolute_url')
    list_filter = ['created_at', 'published_at']
    search_fields = ['name']


<mask token>

<mask token>


class ChapterInline(admin.TabularInline):
    model = Chapter
    extra = 1


class BookAdmin(admin.ModelAdmin):
    fieldsets = [('GENERAL BOOK INFO', {'fields': ['title',
        'long_description', 'short_description']}), (
        'PUBLISHING INFORMATION', {'fields': ['published_at'], 'classes': [
        'collapse']})]
    inlines = [ChapterInline]
    list_display = ('title', 'created_at', 'published_at',
        'was_published_recently', 'get_absolute_url')
    list_filter = ['created_at', 'published_at']
    search_fields = ['title']


class ChapterAdmin(admin.ModelAdmin):
    fieldsets = [('GENERAL CHAPTER INFO', {'fields': ['book', 'name',
        'content']}), ('PUBLISHING INFORMATION', {'fields': ['published_at'
        ], 'classes': ['collapse']}), ('SCORE INFORMATION', {'fields': [
        'score']})]
    list_display = ('name', 'book', 'created_at', 'published_at',
        'was_published_recently', 'get_absolute_url')
    list_filter = ['created_at', 'published_at']
    search_fields = ['name']


admin.site.register(Book, BookAdmin)
admin.site.register(Chapter, ChapterAdmin)

from django.contrib import admin
from .models import Book, Chapter


class ChapterInline(admin.TabularInline):
    model = Chapter
    extra = 1


class BookAdmin(admin.ModelAdmin):
    fieldsets = [('GENERAL BOOK INFO', {'fields': ['title',
        'long_description', 'short_description']}), (
        'PUBLISHING INFORMATION', {'fields': ['published_at'], 'classes': [
        'collapse']})]
    inlines = [ChapterInline]
    list_display = ('title', 'created_at', 'published_at',
        'was_published_recently', 'get_absolute_url')
    list_filter = ['created_at', 'published_at']
    search_fields = ['title']


class ChapterAdmin(admin.ModelAdmin):
    fieldsets = [('GENERAL CHAPTER INFO', {'fields': ['book', 'name',
        'content']}), ('PUBLISHING INFORMATION', {'fields': ['published_at'
        ], 'classes': ['collapse']}), ('SCORE INFORMATION', {'fields': [
        'score']})]
    list_display = ('name', 'book', 'created_at', 'published_at',
        'was_published_recently', 'get_absolute_url')
    list_filter = ['created_at', 'published_at']
    search_fields = ['name']


admin.site.register(Book, BookAdmin)
admin.site.register(Chapter, ChapterAdmin)

# Django imports
from django.contrib import admin
# Internal imports
from .models import Book, Chapter
# External imports

# * Class for displaying chapters inside of the book entry, in TabularInLine form
class ChapterInline(admin.TabularInline):
    model = Chapter
    extra = 1 # Just one block of new chapter offered by default

# * Class defining the model Book for the admin
class BookAdmin(admin.ModelAdmin):
    # Defining what and how things will be shown in the specific table of a Book
    fieldsets = [
        ('GENERAL BOOK INFO',      {'fields': ['title','long_description','short_description']}),
        ('PUBLISHING INFORMATION', {'fields': ['published_at'], 'classes': ['collapse']}),
    ]
    inlines = [ChapterInline] # Adds the class ChapterInLine to the specific table of a Book
    list_display = ('title', 'created_at', 'published_at', 'was_published_recently', 'get_absolute_url') # Defines values shown in the general table
    list_filter = ['created_at', 'published_at'] # Defines filters to be shown in the general table
    search_fields = ['title'] # Defines the search box of the general table

# * Class defining the model Chapter for the admin
class ChapterAdmin(admin.ModelAdmin):
    # Defining what and how things will be shown in the specific table of a Chapter
    fieldsets = [
        ('GENERAL CHAPTER INFO',      {'fields': ['book', 'name', 'content']}),
        ('PUBLISHING INFORMATION', {'fields': ['published_at'], 'classes': ['collapse']}),
        ('SCORE INFORMATION', {'fields': ['score']}),
    ]
    list_display = ('name', 'book', 'created_at', 'published_at', 'was_published_recently', 'get_absolute_url') # Defines values shown in the general table
    list_filter = ['created_at', 'published_at'] # Defines filters to be shown in the general table
    search_fields = ['name'] # Defines the search box of the general table

# * Registering the models to the admin page
admin.site.register(Book, BookAdmin)
admin.site.register(Chapter, ChapterAdmin)