<commit_before># -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django_services import admin
from ..service.databaseregionmigrationdetail import DatabaseRegionMigrationDetailService
from .. import models
import logging
from django.utils.html import format_html

LOG = logging.getLogger(__name__)


class DatabaseRegionMigrationDetailAdmin(admin.DjangoServicesAdmin):
    actions = None
    service_class = DatabaseRegionMigrationDetailService
    search_fields = ("step", "status")
    list_display = ("database_region_migration", "step", "scheduled_for",
                    "friendly_status", "started_at", "finished_at", "created_by",
                    "revoked_by",)
    fields = ("database_region_migration", "step", "scheduled_for",
              "status", "started_at", "finished_at", "created_by",
              "revoked_by", "log",)
    readonly_fields = fields

    ordering = ["-scheduled_for", ]

    def friendly_status(self, detail):

        html_success = '<span class="label label-info">Success</span>'
        html_rejected = '<span class="label label-important">{}</span>'
        html_waiting = '<span class="label label-warning">Waiting</span>'
        html_running = '<span class="label label-success">Running</span>'
        html_revoked = '<span class="label label-primary">{}</span>'

        if detail.status == models.DatabaseRegionMigrationDetail.SUCCESS:
            return format_html(html_success)
        elif detail.status == models.DatabaseRegionMigrationDetail.ROLLBACK:
            return format_html(html_rejected.format("Rollback"))
        elif detail.status == models.DatabaseRegionMigrationDetail.WAITING:
            return format_html(html_waiting)
        elif detail.status == models.DatabaseRegionMigrationDetail.RUNNING:
            return format_html(html_running)
        elif detail.status == models.DatabaseRegionMigrationDetail.REVOKED:
            return format_html(html_revoked.format("Revoked"))

    friendly_status.short_description = "Status"

    def has_delete_permission(self, request, obj=None):
        return False

    def has_add_permission(self, request, obj=None):
        return False<commit_msg>Change database region migration detail frindly status<commit_after># -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django_services import admin
from ..service.databaseregionmigrationdetail import DatabaseRegionMigrationDetailService
from .. import models
import logging
from django.utils.html import format_html

LOG = logging.getLogger(__name__)


class DatabaseRegionMigrationDetailAdmin(admin.DjangoServicesAdmin):
    actions = None
    service_class = DatabaseRegionMigrationDetailService
    search_fields = ("step", "status")
    list_display = ("database_region_migration", "step", "scheduled_for",
                    "friendly_status", "started_at", "finished_at", "created_by",
                    "revoked_by",)
    fields = ("database_region_migration", "step", "scheduled_for",
              "status", "started_at", "finished_at", "created_by",
              "revoked_by", "log",)
    readonly_fields = fields

    ordering = ["-scheduled_for", ]

    def friendly_status(self, detail):

        html_success = '<span class="label label-info">Success</span>'
        html_rejected = '<span class="label label-important">{}</span>'
        html_waiting = '<span class="label label-warning">Waiting</span>'
        html_running = '<span class="label label-success">Running</span>'
        html_revoked = '<span class="label label-primary">{}</span>'

        if detail.status == models.DatabaseRegionMigrationDetail.SUCCESS:
            return format_html(html_success)
        elif detail.status == models.DatabaseRegionMigrationDetail.ROLLBACK:
            return format_html(html_rejected.format("Rollback"))
        elif detail.status == models.DatabaseRegionMigrationDetail.WAITING:
            return format_html(html_waiting)
        elif detail.status == models.DatabaseRegionMigrationDetail.RUNNING:
            return format_html(html_running)
        elif detail.status == models.DatabaseRegionMigrationDetail.REVOKED:
            return format_html(html_revoked.format("Revoked"))
        elif detail.status == models.DatabaseRegionMigrationDetail.ERROR:
            return format_html(html_rejected.format("Error"))

    friendly_status.short_description = "Status"

    def has_delete_permission(self, request, obj=None):
        return False

    def has_add_permission(self, request, obj=None):
        return False
{'fraction_non_alphanumeric': 0.10616960976673206, 'fraction_numerical': 0.0004360148245040331, 'mean_word_length': 3.75440414507772, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '6077876', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1205, 'n_words': 252}