<commit_before># coding : utf -8

from quokka import admin
from quokka.core.admin import _, _l
from quokka.core.admin.models import ModelAdmin, BaseContentAdmin
from quokka.core.admin.fields import ThumbField
from quokka.core.widgets import TextEditor, PrepopulatedText

from .models import Campaign, Donation


class CampaignAdmin(BaseContentAdmin):

    column_searchable_list = ('title', 'description', 'summary')

    form_args = {
        "description": {"widget": TextEditor()},
        "slug": {"widget": PrepopulatedText(master='title')}
    }

    form_columns = ['title', 'slug', 'channel', 'related_channels', 'summary',
                    'content_format', 'description', 'published',
                    'start_date', 'end_date',
                    'min_value', 'max_value',
                    'goal', 'balance',
                    'open_for_donations',
                    'add_image', 'contents',
                    'show_on_channel', 'available_at', 'available_until',
                    'tags', 'values', 'template_type', 'donations']

    form_subdocuments = {
        'contents': {
            'form_subdocuments': {
                None: {
                    'form_columns': ('content', 'caption', 'purpose',
                                     'order', 'thumb'),
                    'form_ajax_refs': {
                        'content': {
                            'fields': ['title', 'long_slug', 'summary']
                        }
                    },
                    'form_extra_fields': {
                        'thumb': ThumbField('thumb', endpoint="media")
                    }
                }
            }
        },
    }


class DonationAdmin(ModelAdmin):
    roles_accepted = ('admin', 'editor')
    column_list = ['donor', 'created_at', 'values', 'total', 'tax',
                   'payment_method', 'status', 'published']
    column_searchable_list = ['search_helper', 'payment_method']
    form_columns = ['donor', 'created_at', 'values', 'total', 'tax',
                    'payment_method', 'status', 'published',
                    'confirmed_date', 'display_name']

    column_formatters = {
        'created_at': ModelAdmin.formatters.get('datetime'),
        'available_at': ModelAdmin.formatters.get('datetime'),
        'values': ModelAdmin.formatters.get('ul'),
        'status': ModelAdmin.formatters.get('status'),
    }

    column_formatters_args = {
        'ul': {
            'values': {
                'placeholder': u"{item.campaign.title} - {item.value}",
                'style': "min-width:200px;max-width:300px;"
            }
        },
        'status': {
            'status': {
                'labels': {
                    'confirmed': 'success',
                    'checked_out': 'warning',
                    'cancelled': 'danger',
                    'completed': 'success'
                },
                'style': 'min-height:18px;'
            }
        }
    }

<commit_msg>fix label css class<commit_after># coding : utf -8

from quokka import admin
from quokka.core.admin import _, _l
from quokka.core.admin.models import ModelAdmin, BaseContentAdmin
from quokka.core.admin.fields import ThumbField
from quokka.core.widgets import TextEditor, PrepopulatedText

from .models import Campaign, Donation


class CampaignAdmin(BaseContentAdmin):

    column_searchable_list = ('title', 'description', 'summary')

    form_args = {
        "description": {"widget": TextEditor()},
        "slug": {"widget": PrepopulatedText(master='title')}
    }

    form_columns = ['title', 'slug', 'channel', 'related_channels', 'summary',
                    'content_format', 'description', 'published',
                    'start_date', 'end_date',
                    'min_value', 'max_value',
                    'goal', 'balance',
                    'open_for_donations',
                    'add_image', 'contents',
                    'show_on_channel', 'available_at', 'available_until',
                    'tags', 'values', 'template_type', 'donations']

    form_subdocuments = {
        'contents': {
            'form_subdocuments': {
                None: {
                    'form_columns': ('content', 'caption', 'purpose',
                                     'order', 'thumb'),
                    'form_ajax_refs': {
                        'content': {
                            'fields': ['title', 'long_slug', 'summary']
                        }
                    },
                    'form_extra_fields': {
                        'thumb': ThumbField('thumb', endpoint="media")
                    }
                }
            }
        },
    }


class DonationAdmin(ModelAdmin):
    roles_accepted = ('admin', 'editor')
    column_list = ['donor', 'created_at', 'values', 'total', 'tax',
                   'payment_method', 'status', 'published']
    column_searchable_list = ['search_helper', 'payment_method']
    form_columns = ['donor', 'created_at', 'values', 'total', 'tax',
                    'payment_method', 'status', 'published',
                    'confirmed_date', 'display_name']

    column_formatters = {
        'created_at': ModelAdmin.formatters.get('datetime'),
        'available_at': ModelAdmin.formatters.get('datetime'),
        'values': ModelAdmin.formatters.get('ul'),
        'status': ModelAdmin.formatters.get('status'),
    }

    column_formatters_args = {
        'ul': {
            'values': {
                'placeholder': u"{item.campaign.title} - {item.value}",
                'style': "min-width:200px;max-width:300px;"
            }
        },
        'status': {
            'status': {
                'labels': {
                    'confirmed': 'success',
                    'checked_out': 'warning',
                    'cancelled': 'important',
                    'completed': 'success'
                },
                'style': 'min-height:18px;'
            }
        }
    }


{'fraction_non_alphanumeric': 0.14067483632701025, 'fraction_numerical': 0.003021655195568239, 'mean_word_length': 1.6983695652173914, 'pattern_counts': {'":': 8, '<': 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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5224723', 'n_tokens_mistral': 1657, 'n_tokens_neox': 1564, 'n_words': 297}