<commit_before># Customize Admin

Customizing the admin functionality can be as complex as overriding the `ModelAdmin`
and `ModelForm` that ships with `pinax-blog` or as simple as just overriding
the `admin/blog/post/change_form.html` template.

Here is an example of an actual customization to use the [ACE Editor]() for
teaser and body content:

    {% extends "admin/change_form.html" %}
    {% load i18n admin_urls %}
    {% block extrahead %}
        {{ block.super }}
        <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.1.3/ace.js"></script>
        <script>
        $(function () {
            var contentDiv = $("<div>").attr("id", "content-editor"),
                teaserDiv = $("<div>").attr("id", "teaser-editor"),
                setupEditor = function (editor, textarea) {
                    editor.setTheme("ace/theme/twilight");
                    editor.getSession().setMode("ace/mode/markdown");
                    editor.getSession().setValue(textarea.val());
                    editor.getSession().setUseWrapMode(true);
                    editor.getSession().on('change', function(){
                      textarea.val(editor.getSession().getValue());
                    });
                    editor.getSession().setTabSize(4);
                    editor.getSession().setUseSoftTabs(true);
                };
            $(".content .c-2").append(contentDiv);
            $(".teaser .c-2").append(teaserDiv);
            var editor1 = ace.edit("content-editor");
            var editor2 = ace.edit("teaser-editor");
            var textarea1 = $('textarea[name="content"]').hide();
            var textarea2 = $('textarea[name="teaser"]').hide();
            setupEditor(editor1, textarea1);<commit_msg>Update sample to work with latest Django<commit_after># Customize Admin

Customizing the admin functionality can be as complex as overriding the `ModelAdmin`
and `ModelForm` that ships with `pinax-blog` or as simple as just overriding
the `admin/blog/post/change_form.html` template.

Here is an example of an actual customization to use the [ACE Editor]() for
teaser and body content:

    {% extends "admin/change_form.html" %}
    {% load i18n admin_urls %}
    {% block extrahead %}
        {{ block.super }}
        <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
        <script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.1.8/ace.js"></script>
        <script>
        $(function () {
            var contentDiv = $("<div>").attr("id", "content-editor"),
                teaserDiv = $("<div>").attr("id", "teaser-editor"),
                setupEditor = function (editor, textarea) {
                    editor.setTheme("ace/theme/twilight");
                    editor.getSession().setMode("ace/mode/markdown");
                    editor.getSession().setValue(textarea.val());
                    editor.getSession().setUseWrapMode(true);
                    editor.getSession().on('change', function(){
                      textarea.val(editor.getSession().getValue());
                    });
                    editor.getSession().setTabSize(4);
                    editor.getSession().setUseSoftTabs(true);
                };
            $(".field-content div").append(contentDiv);
            $(".field-teaser div").append(teaserDiv);
            var editor1 = ace.edit("content-editor");
            var editor2 = ace.edit("teaser-editor");
            var textarea1 = $('textarea[name="content"]').hide();
            var textarea2 = $('textarea[name="teaser"]').hide();
            setupEditor(editor1, textarea1);
{'fraction_non_alphanumeric': 0.1525929948411621, 'fraction_numerical': 0.008688569101276133, 'mean_word_length': 2.1979166666666665, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 1, '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': '1966991', 'n_tokens_mistral': 1056, 'n_tokens_neox': 985, 'n_words': 205}