Login

Admin Word Count

Author:
bahoo
Posted:
October 6, 2010
Language:
HTML/template
Version:
1.2
Score:
1 (after 1 ratings)

I'm on my own personal writing challenge (see 750words.com for inspiration). I needed a way to get a dynamic word count, so I threw this together. Tied into django-basic-blog easily.

 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. Bootstrap Accordian by Netplay4 7 years, 9 months ago
  2. Bootstrap theme for django-endless-pagination? by se210 10 years, 9 months ago
  3. Bootstrap theme for django-endless-pagination? by se210 10 years, 9 months ago
  4. Reusable form template with generic view by roldandvg 10 years, 10 months ago
  5. Pagination Django with Boostrap by guilegarcia 11 years ago

Comments

Please login first before commenting.