<commit_before>from workflows.models import Category, AbstractWidget, AbstractInput, AbstractOutput, AbstractOption, Workflow
from django.contrib import admin
from django.forms import TextInput, Textarea
from django.db import models

from orderable_inlines import OrderableTabularInline

class OrderableTabularInlineStyled(OrderableTabularInline):
    formfield_overrides = {
        models.CharField: {'widget': TextInput(attrs={'size':10})},
        models.TextField: {'widget': Textarea(attrs={'rows':1, 'cols':20})},
        }
    orderable_field = 'order'

class InputInline(OrderableTabularInlineStyled):
    model = AbstractInput

class CategoryInline(OrderableTabularInlineStyled):<commit_msg>Small (productivity) improvements of admin sites: - "Save as new" button to all admin interfaces - admin buttons also on the top of the page - search button on top of admin lists (always searches by name)<commit_after>from workflows.models import Category, AbstractWidget, AbstractInput, AbstractOutput, AbstractOption, Workflow
from django.contrib import admin
from django.forms import TextInput, Textarea
from django.db import models

from orderable_inlines import OrderableTabularInline

admin.ModelAdmin.save_as = True; #adds "Save as new" button to all admin interfaces
admin.ModelAdmin.save_on_top = True; #adds admin buttons also on the top of the page
admin.ModelAdmin.search_fields = ['name'] #adds search button on top of admin lists (allways searches by name)

class OrderableTabularInlineStyled(OrderableTabularInline):
    formfield_overrides = {
        models.CharField: {'widget': TextInput(attrs={'size':10})},
        models.TextField: {'widget': Textarea(attrs={'rows':1, 'cols':20})},
        }
    orderable_field = 'order'

class InputInline(OrderableTabularInlineStyled):
    model = AbstractInput

class CategoryInline(OrderableTabularInlineStyled):
{'fraction_non_alphanumeric': 0.0864461045891142, 'fraction_numerical': 0.005336179295624333, 'mean_word_length': 5.818181818181818, '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': '3698092', 'n_tokens_mistral': 515, 'n_tokens_neox': 517, 'n_words': 157}