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

from opps.core.models import Post



class PostAdmin(admin.ModelAdmin):
    prepopulated_fields = {"slug": ("title",)}
admin.site.register(Post, PostAdmin)<commit_msg>Auto set user (auth) on save post mdoels (django admin)<commit_after># -*- 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)
{'fraction_non_alphanumeric': 0.1354642313546423, 'fraction_numerical': 0.0030441400304414, 'mean_word_length': 3.7681159420289854, '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': '4595310', 'n_tokens_mistral': 205, 'n_tokens_neox': 199, 'n_words': 56}