from django.contrib import admin

from comics.core import models


class ComicAdmin(admin.ModelAdmin):
    list_display = ('slug', 'name', 'language', 'url', 'rights')
    prepopulated_fields = {
        'slug': ('name',)
    }


class ReleaseAdmin(admin.ModelAdmin):
    list_display = ('__unicode__', 'comic', 'pub_date', 'fetched')
    list_filter = ['pub_date', 'fetched', 'comic']
    date_hierarchy = 'pub_date'
    exclude = ('images',)


class ImageAdmin(admin.ModelAdmin):
    list_display = ('__unicode__', 'file', 'height', 'width', 'fetched', 'title', 'text')
    list_filter = ['fetched', 'comic']
    date_hierarchy = 'fetched'


admin.site.register(models.Comic, ComicAdmin)
admin.site.register(models.Release, ReleaseAdmin)
admin.site.register(models.Image, ImageAdmin)

from django.contrib import admin

from comics.core import models


class ComicAdmin(admin.ModelAdmin):
    list_display = ('slug', 'name', 'language', 'url', 'rights', 'start_date',
        'end_date', 'active')
    prepopulated_fields = {
        'slug': ('name',)
    }


class ReleaseAdmin(admin.ModelAdmin):
    list_display = ('__unicode__', 'comic', 'pub_date', 'fetched')
    list_filter = ['pub_date', 'fetched', 'comic']
    date_hierarchy = 'pub_date'
    exclude = ('images',)


class ImageAdmin(admin.ModelAdmin):
    list_display = ('__unicode__', 'file', 'height', 'width', 'fetched', 'title', 'text')
    list_filter = ['fetched', 'comic']
    date_hierarchy = 'fetched'


admin.site.register(models.Comic, ComicAdmin)
admin.site.register(models.Release, ReleaseAdmin)
admin.site.register(models.Image, ImageAdmin)

Include start date, end date, and active flag in comics list
Include start date, end date, and active flag in comics list

  from django.contrib import admin
  
  from comics.core import models
  
  
  class ComicAdmin(admin.ModelAdmin):
-     list_display = ('slug', 'name', 'language', 'url', 'rights')
+     list_display = ('slug', 'name', 'language', 'url', 'rights', 'start_date',
+         'end_date', 'active')
      prepopulated_fields = {
          'slug': ('name',)
      }
  
  
  class ReleaseAdmin(admin.ModelAdmin):
      list_display = ('__unicode__', 'comic', 'pub_date', 'fetched')
      list_filter = ['pub_date', 'fetched', 'comic']
      date_hierarchy = 'pub_date'
      exclude = ('images',)
  
  
  class ImageAdmin(admin.ModelAdmin):
      list_display = ('__unicode__', 'file', 'height', 'width', 'fetched', 'title', 'text')
      list_filter = ['fetched', 'comic']
      date_hierarchy = 'fetched'
  
  
  admin.site.register(models.Comic, ComicAdmin)
  admin.site.register(models.Release, ReleaseAdmin)
  admin.site.register(models.Image, ImageAdmin)
  
Include start date, end date, and active flag in comics list
## Code Before:
from django.contrib import admin

from comics.core import models


class ComicAdmin(admin.ModelAdmin):
    list_display = ('slug', 'name', 'language', 'url', 'rights')
    prepopulated_fields = {
        'slug': ('name',)
    }


class ReleaseAdmin(admin.ModelAdmin):
    list_display = ('__unicode__', 'comic', 'pub_date', 'fetched')
    list_filter = ['pub_date', 'fetched', 'comic']
    date_hierarchy = 'pub_date'
    exclude = ('images',)


class ImageAdmin(admin.ModelAdmin):
    list_display = ('__unicode__', 'file', 'height', 'width', 'fetched', 'title', 'text')
    list_filter = ['fetched', 'comic']
    date_hierarchy = 'fetched'


admin.site.register(models.Comic, ComicAdmin)
admin.site.register(models.Release, ReleaseAdmin)
admin.site.register(models.Image, ImageAdmin)

## Instruction:
Include start date, end date, and active flag in comics list
## Code After:
from django.contrib import admin

from comics.core import models


class ComicAdmin(admin.ModelAdmin):
    list_display = ('slug', 'name', 'language', 'url', 'rights', 'start_date',
        'end_date', 'active')
    prepopulated_fields = {
        'slug': ('name',)
    }


class ReleaseAdmin(admin.ModelAdmin):
    list_display = ('__unicode__', 'comic', 'pub_date', 'fetched')
    list_filter = ['pub_date', 'fetched', 'comic']
    date_hierarchy = 'pub_date'
    exclude = ('images',)


class ImageAdmin(admin.ModelAdmin):
    list_display = ('__unicode__', 'file', 'height', 'width', 'fetched', 'title', 'text')
    list_filter = ['fetched', 'comic']
    date_hierarchy = 'fetched'


admin.site.register(models.Comic, ComicAdmin)
admin.site.register(models.Release, ReleaseAdmin)
admin.site.register(models.Image, ImageAdmin)
