<commit_before># -*- coding: utf-8 -*-
from django.contrib import admin

from opps.core.models import Post



class PostAdmin(admin.ModelAdmin):
    prepopulated_fields = {"slug": ("title",)}

    def save_model(self, request, obj, form, change):
        if not obj.user:
            obj.user = request.user
        obj.save()
admin.site.register(Post, PostAdmin)<commit_msg>Create post admin form, custom content field add texteditor<commit_after># -*- coding: utf-8 -*-
from django.contrib import admin
from django import forms

from opps.core.models import Post

from redactor.widgets import RedactorEditor



class PostAdminForm(forms.ModelForm):
    class Meta:
        model = Post
        widgets = {'content': RedactorEditor(),}


class PostAdmin(admin.ModelAdmin):
    form = PostAdminForm
    prepopulated_fields = {"slug": ("title",)}

    def save_model(self, request, obj, form, change):
        if not obj.user:
            obj.user = request.user
        obj.save()
admin.site.register(Post, PostAdmin)
{'fraction_non_alphanumeric': 0.1160275319567355, 'fraction_numerical': 0.0019665683382497543, 'mean_word_length': 3.277310924369748, 'pattern_counts': {'":': 2, '<': 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': '3681334', 'n_tokens_mistral': 301, 'n_tokens_neox': 292, 'n_words': 86}