{% extends "admin/change_form.html" %}
{% load static i18n %}

{% block body_main %}

{{ block.super }}
<script>
    document.addEventListener('DOMContentLoaded', function() {
    var contentTypeField = document.querySelector('#id_content_type');
    var publishStatusRow = document.querySelector('.form-row.field-publish_status');
    
    function togglePublishStatusVisibility() {
        if (contentTypeField && publishStatusRow) {
            if (contentTypeField.value === 'txt') {
                publishStatusRow.style.display = 'none';
            } else {
                publishStatusRow.style.display = '';
            }
        }
    }
    
    // 初始状态
    togglePublishStatusVisibility();
    
    // 监听内容类型变化
    if (contentTypeField) {
        contentTypeField.addEventListener('change', togglePublishStatusVisibility);
    }
});
</script>
{% endblock %}
