<commit_before>from django import forms
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _

from core.widgets import SimpleMDEWidget
from .models import GenomeReference, Report


@admin.register(GenomeReference)
class GenomeReferenceAdmin(admin.ModelAdmin):

    list_display = (
        'organism',
        'identifier',
        'source',
        'newer_reference',
    )
    list_display_links = ['identifier']
    list_filter = (
        'organism', 'source',
    )


@admin.register(Report)
class ReportAdmin(admin.ModelAdmin):

    readonly_fields = (
        "pk",
    )

    def analysis_name(self, report):
        return report.analysis.name
    analysis_name.short_description = 'Analysis'

    list_display = (
        'analysis_name', 'date_created',
    )


class AbstractAnalysisAdminUpdateForm(forms.ModelForm):

    class Meta:
        fields = '__all__'
        widgets = {
            'description': SimpleMDEWidget(),
        }

    @property
    def media(self):
        return super().media + forms.Media(
            css={'all': ['css/tools/simplemde-admin-setup.css']},
            js=['js/tools/simplemde-admin-setup.js'],
        )


class AbstractAnalysisAdmin(admin.ModelAdmin):

    form = AbstractAnalysisAdminUpdateForm
    list_display = (
        "date_created",
        "date_finished",
        "execution_status",
        "name",
        "owner",
        "genome_reference",<commit_msg>Display auth key in admin<commit_after>from django import forms
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _

from core.widgets import SimpleMDEWidget
from .models import GenomeReference, Report


@admin.register(GenomeReference)
class GenomeReferenceAdmin(admin.ModelAdmin):

    list_display = (
        'organism',
        'identifier',
        'source',
        'newer_reference',
    )
    list_display_links = ['identifier']
    list_filter = (
        'organism', 'source',
    )


@admin.register(Report)
class ReportAdmin(admin.ModelAdmin):

    readonly_fields = (
        "pk", "auth_key",
    )

    def analysis_name(self, report):
        return report.analysis.name
    analysis_name.short_description = 'Analysis'

    def auth_key(self, report):
        return report.auth_key
    auth_key.short_description = 'Authentication key'

    list_display = (
        'pk', 'analysis_name', 'date_created',
    )
    list_display_links = (
        'pk', 'analysis_name',
    )


class AbstractAnalysisAdminUpdateForm(forms.ModelForm):

    class Meta:
        fields = '__all__'
        widgets = {
            'description': SimpleMDEWidget(),
        }

    @property
    def media(self):
        return super().media + forms.Media(
            css={'all': ['css/tools/simplemde-admin-setup.css']},
            js=['js/tools/simplemde-admin-setup.js'],
        )


class AbstractAnalysisAdmin(admin.ModelAdmin):

    form = AbstractAnalysisAdminUpdateForm
    list_display = (
        "date_created",
        "date_finished",
        "execution_status",
        "name",
        "owner",
        "genome_reference",
{'fraction_non_alphanumeric': 0.10933503836317135, 'fraction_numerical': 0.0, 'mean_word_length': 2.685512367491166, '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': '6399171', 'n_tokens_mistral': 917, 'n_tokens_neox': 885, 'n_words': 174}