"""Admin for talk-related models."""

from pygotham.admin.utils import model_view
from pygotham.talks import models

__all__ = ('CategoryModelView', 'TalkModelView', 'TalkReviewModelView')


CategoryModelView = model_view(
    models.Category,
    'Categories',
    'Talks',
    form_columns=('name', 'slug'),
)

TalkModelView = model_view(
    models.Talk,
    'Talks',
    'Talks',
    column_list=('name', 'status', 'level', 'type', 'user'),
    column_searchable_list=('name',),
)

TalkReviewModelView = model_view(
    models.Talk,
    'Review',
    'Talks',
    can_create=False,
    can_delete=False,
    column_list=('name', 'status', 'level', 'type', 'user'),
    column_searchable_list=('name',),
    edit_template='talks/review.html',
)

"""Admin for talk-related models."""

from pygotham.admin.utils import model_view
from pygotham.talks import models

__all__ = ('CategoryModelView', 'TalkModelView', 'TalkReviewModelView')


CategoryModelView = model_view(
    models.Category,
    'Categories',
    'Talks',
    form_columns=('name', 'slug'),
)

TalkModelView = model_view(
    models.Talk,
    'Talks',
    'Talks',
    column_filters=('status', 'duration', 'level'),
    column_list=('name', 'status', 'duration', 'level', 'type', 'user'),
    column_searchable_list=('name',),
)

TalkReviewModelView = model_view(
    models.Talk,
    'Review',
    'Talks',
    can_create=False,
    can_delete=False,
    column_list=('name', 'status', 'level', 'type', 'user'),
    column_searchable_list=('name',),
    edit_template='talks/review.html',
)

Add filters to the talk admin
Add filters to the talk admin

@logston is reviewing talks and wanted to see the talk duration. He also
thought it would be useful to be able to filter by the duration and
status of the talk.

  """Admin for talk-related models."""
  
  from pygotham.admin.utils import model_view
  from pygotham.talks import models
  
  __all__ = ('CategoryModelView', 'TalkModelView', 'TalkReviewModelView')
  
  
  CategoryModelView = model_view(
      models.Category,
      'Categories',
      'Talks',
      form_columns=('name', 'slug'),
  )
  
  TalkModelView = model_view(
      models.Talk,
      'Talks',
      'Talks',
+     column_filters=('status', 'duration', 'level'),
-     column_list=('name', 'status', 'level', 'type', 'user'),
+     column_list=('name', 'status', 'duration', 'level', 'type', 'user'),
      column_searchable_list=('name',),
  )
  
  TalkReviewModelView = model_view(
      models.Talk,
      'Review',
      'Talks',
      can_create=False,
      can_delete=False,
      column_list=('name', 'status', 'level', 'type', 'user'),
      column_searchable_list=('name',),
      edit_template='talks/review.html',
  )
  
Add filters to the talk admin
## Code Before:
"""Admin for talk-related models."""

from pygotham.admin.utils import model_view
from pygotham.talks import models

__all__ = ('CategoryModelView', 'TalkModelView', 'TalkReviewModelView')


CategoryModelView = model_view(
    models.Category,
    'Categories',
    'Talks',
    form_columns=('name', 'slug'),
)

TalkModelView = model_view(
    models.Talk,
    'Talks',
    'Talks',
    column_list=('name', 'status', 'level', 'type', 'user'),
    column_searchable_list=('name',),
)

TalkReviewModelView = model_view(
    models.Talk,
    'Review',
    'Talks',
    can_create=False,
    can_delete=False,
    column_list=('name', 'status', 'level', 'type', 'user'),
    column_searchable_list=('name',),
    edit_template='talks/review.html',
)

## Instruction:
Add filters to the talk admin
## Code After:
"""Admin for talk-related models."""

from pygotham.admin.utils import model_view
from pygotham.talks import models

__all__ = ('CategoryModelView', 'TalkModelView', 'TalkReviewModelView')


CategoryModelView = model_view(
    models.Category,
    'Categories',
    'Talks',
    form_columns=('name', 'slug'),
)

TalkModelView = model_view(
    models.Talk,
    'Talks',
    'Talks',
    column_filters=('status', 'duration', 'level'),
    column_list=('name', 'status', 'duration', 'level', 'type', 'user'),
    column_searchable_list=('name',),
)

TalkReviewModelView = model_view(
    models.Talk,
    'Review',
    'Talks',
    can_create=False,
    can_delete=False,
    column_list=('name', 'status', 'level', 'type', 'user'),
    column_searchable_list=('name',),
    edit_template='talks/review.html',
)
