<commit_before>from django import forms
from django.contrib import admin
from django.contrib.auth.models import User

from us_ignite.blog.models import Post


class PostAdminForm(forms.ModelForm):
    author = forms.ModelChoiceField(
        queryset=User.objects.filter(is_superuser=True))

    class Meta:
        model = Post


class PostAdmin(admin.ModelAdmin):
    list_display = ('title', 'author', 'is_published', 'is_featured', 'status')
    list_filter = ('status', 'publication_date')
    search_fields = ('slug', 'title', 'body', 'summary')
    date_hierarchy = 'publication_date'
    prepopulated_fields = {'slug': ('title',)}
    form = PostAdminForm


admin.site.register(Post, PostAdmin)<commit_msg>Updated admin UI to show ``PostAttachments``.<commit_after>from django import forms
from django.contrib import admin
from django.contrib.auth.models import User

from us_ignite.blog.models import Post, PostAttachment


class PostAdminForm(forms.ModelForm):
    author = forms.ModelChoiceField(
        queryset=User.objects.filter(is_superuser=True))

    class Meta:
        model = Post


class PostAttachmentInline(admin.StackedInline):
    model = PostAttachment


class PostAdmin(admin.ModelAdmin):
    list_display = ('title', 'author', 'is_published', 'is_featured', 'status')
    list_filter = ('status', 'publication_date')
    search_fields = ('slug', 'title', 'body', 'summary')
    date_hierarchy = 'publication_date'
    prepopulated_fields = {'slug': ('title',)}
    form = PostAdminForm
    inlines = [PostAttachmentInline]


admin.site.register(Post, PostAdmin)
{'fraction_non_alphanumeric': 0.11942174732872407, 'fraction_numerical': 0.0, 'mean_word_length': 4.706093189964157, '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': '1425622', 'n_tokens_mistral': 477, 'n_tokens_neox': 476, 'n_words': 111}