<commit_before>"""Admin for talk-related models."""

from flask.ext.admin import actions
from flask.ext.admin.contrib.sqla import ModelView

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

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

CATEGORY = 'Talks'


class TalkModelView(ModelView, actions.ActionsMixin):

    """Admin view for :class:`~pygotham.models.Talk`."""

    column_filters = ('status', 'duration', 'level')
    column_list = ('name', 'status', 'duration', 'level', 'type', 'user')
    column_searchable_list = ('name',)

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.init_actions()

    @actions.action(
        'accept', 'Accept', 'Are you sure you want to accept selected models?')
    def approve(self, talks):
        for pk in talks:<commit_msg>Hide the presentation in the talk admin<commit_after>"""Admin for talk-related models."""

from flask.ext.admin import actions
from flask.ext.admin.contrib.sqla import ModelView

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

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

CATEGORY = 'Talks'


class TalkModelView(ModelView, actions.ActionsMixin):

    """Admin view for :class:`~pygotham.models.Talk`."""

    column_filters = ('status', 'duration', 'level')
    column_list = ('name', 'status', 'duration', 'level', 'type', 'user')
    column_searchable_list = ('name',)
    form_excluded_columns = ('presentation',)

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.init_actions()

    @actions.action(
        'accept', 'Accept', 'Are you sure you want to accept selected models?')
    def approve(self, talks):
        for pk in talks:
{'fraction_non_alphanumeric': 0.14042553191489363, 'fraction_numerical': 0.0, 'mean_word_length': 4.34375, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7114317', 'n_tokens_mistral': 601, 'n_tokens_neox': 577, 'n_words': 159}