<commit_before># -*- coding: utf-8 -*-
from admin_enhancer.admin import EnhancedModelAdminMixin
from cms.admin.placeholderadmin import PlaceholderAdmin, FrontendEditableAdmin
from copy import deepcopy
from django.contrib import admin
from django.conf import settings
from parler.admin import TranslatableAdmin

from .models import Post, BlogCategory


class BlogCategoryAdmin(EnhancedModelAdminMixin, TranslatableAdmin):
    def get_prepopulated_fields(self, request, obj=None):
        return {"slug": ("name",)}

    class Media:
        css = {
            'all': ('%sdjangocms_blog/css/%s' % (settings.STATIC_URL,
                                                  "djangocms_blog_admin.css"),)
        }


class PostAdmin(EnhancedModelAdminMixin, FrontendEditableAdmin,
                PlaceholderAdmin, TranslatableAdmin):
    list_display = ['title', 'author', 'date_published', 'date_published_end']
    date_hierarchy = 'date_published'
    raw_id_fields = ['author']
    frontend_editable_fields = ("title", "abstract")
    enhance_exclude = ('main_image', 'tags')

    _fieldsets = [
        (None, {
            'fields': [('title', 'slug', 'publish'),
                       ('categories', 'tags'),
                       ('date_published', 'date_published_end')]
        }),
        (None, {
            'fields': [('main_image', 'main_image_thumbnail', 'main_image_full'),
                       'abstract', 'meta_description']
        }),
    ]

    def get_fieldsets(self, request, obj=None):
        if request.user.is_superuser:
            fsets = deepcopy(self._fieldsets)
            fsets[0][1]['fields'].append('author')
            return fsets
        else:
            return self._fieldsets

    def get_prepopulated_fields(self, request, obj=None):
        return {"slug": ("title",)}

    def save_model(self, request, obj, form, change):<commit_msg>Add meta_keywords to admin<commit_after># -*- coding: utf-8 -*-
from admin_enhancer.admin import EnhancedModelAdminMixin
from cms.admin.placeholderadmin import PlaceholderAdmin, FrontendEditableAdmin
from copy import deepcopy
from django.contrib import admin
from django.conf import settings
from parler.admin import TranslatableAdmin

from .models import Post, BlogCategory


class BlogCategoryAdmin(EnhancedModelAdminMixin, TranslatableAdmin):
    def get_prepopulated_fields(self, request, obj=None):
        return {"slug": ("name",)}

    class Media:
        css = {
            'all': ('%sdjangocms_blog/css/%s' % (settings.STATIC_URL,
                                                  "djangocms_blog_admin.css"),)
        }


class PostAdmin(EnhancedModelAdminMixin, FrontendEditableAdmin,
                PlaceholderAdmin, TranslatableAdmin):
    list_display = ['title', 'author', 'date_published', 'date_published_end']
    date_hierarchy = 'date_published'
    raw_id_fields = ['author']
    frontend_editable_fields = ("title", "abstract")
    enhance_exclude = ('main_image', 'tags')

    _fieldsets = [
        (None, {
            'fields': [('title', 'slug', 'publish'),
                       ('categories', 'tags'),
                       ('date_published', 'date_published_end')]
        }),
        (None, {
            'fields': [('main_image', 'main_image_thumbnail', 'main_image_full'),
                       'abstract', ('meta_description', 'meta_keywords')]
        }),
    ]

    def get_fieldsets(self, request, obj=None):
        if request.user.is_superuser:
            fsets = deepcopy(self._fieldsets)
            fsets[0][1]['fields'].append('author')
            return fsets
        else:
            return self._fieldsets

    def get_prepopulated_fields(self, request, obj=None):
        return {"slug": ("title",)}

    def save_model(self, request, obj, form, change):
{'fraction_non_alphanumeric': 0.12110817941952506, 'fraction_numerical': 0.0015831134564643799, 'mean_word_length': 2.698536585365854, 'pattern_counts': {'":': 4, '<': 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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4297128', 'n_tokens_mistral': 1088, 'n_tokens_neox': 1067, 'n_words': 231}