<commit_before>from django.contrib import admin

from models import Publishable
from actions import publish_selected

class PublishableAdmin(admin.ModelAdmin):
    
    actions = [publish_selected]
    publish_confirmation_template = None
    
    list_display = ['__unicode__', 'publish_state']

    def queryset(self, request):
        # we want to show draft and deleted
        # objects in changelist in admin
        # so we can let the user select and publish them
        qs = super(PublishableAdmin, self).queryset(request)
        return qs.draft_and_deleted()

    def has_change_permission(self, request, obj=None):
        # use can never change public models directly
        if obj and obj.is_public:
            return False
        return super(PublishableAdmin, self).has_change_permission(request, obj)<commit_msg>Made list_filter show publish_state by default<commit_after>from django.contrib import admin

from models import Publishable
from actions import publish_selected

class PublishableAdmin(admin.ModelAdmin):
    
    actions = [publish_selected]
    publish_confirmation_template = None
    
    list_display = ['__unicode__', 'publish_state']
    list_filter = ['publish_state']

    def queryset(self, request):
        # we want to show draft and deleted
        # objects in changelist in admin
        # so we can let the user select and publish them
        qs = super(PublishableAdmin, self).queryset(request)
        return qs.draft_and_deleted()

    def has_change_permission(self, request, obj=None):
        # use can never change public models directly
        if obj and obj.is_public:
            return False
        return super(PublishableAdmin, self).has_change_permission(request, obj)
{'fraction_non_alphanumeric': 0.06397694524495677, 'fraction_numerical': 0.0, 'mean_word_length': 3.3076923076923075, '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': '5748048', 'n_tokens_mistral': 462, 'n_tokens_neox': 455, 'n_words': 150}