Admin Word Count

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
Anywhere in a settings.TEMPLATE_DIRS directory:

# ./admin/<app>/change_form.html:
****************************************************

{% block extrahead %}
  {{ block.super }}
  <style>label b{font-weight:normal;font-size:0.75em;color:#888;display:block;margin-top:120px;}</style>
  <script type="text/javascript">
    
    django.jQuery(document).ready(function(){
        django.jQuery('#id_body').keypress(function(){
            django.jQuery('label[for=id_body]').html("Body:<b>Word count: " + this.value.split(" ").length + "</b>");
        });
    });
  </script>
{% endblock %}

More like this

  1. Complex Formsets, Redux by smagala 3 years, 2 months ago
  2. Complex Formsets by smagala 4 years, 4 months ago
  3. Class Feeds DRY TemplateTag by gmandx 3 years ago
  4. Tags & filters for rendering search results by exogen 5 years, 2 months ago
  5. Custom optional abstract base attributes by tie 4 years, 11 months ago

Comments

(Forgotten your password?)