Admin Word Count
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.
- jquery
- change-form
- word-count
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.
A confirm alert is displayed if the user has made any changes to the form, and attempts to navigate away from the page without saving (click the back button, hit reload, click the breadcrumbs, logout, etc). Much like GMail's "Your message has not been sent. Discard your message?" prompt. **Uses the JavaScript helpers built into Django**, without relying on 3rd party libs like jQuery. (There might be simpler options if you're already using [jQuery](http://code.google.com/p/protect-data/) or [prototype](http://stackoverflow.com/questions/925111/activating-onbeforeunload-only-when-field-values-have-changed/1013033#1013033)). To use this, simply create a [custom admin template](http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates). For example at: *templates/admin/YOUR_APP_NAME/change_form.html* {% extends "admin/change_form.html" %} {% block after_related_objects %} {{ block.super}} <script type="text/javascript"> ... script goes here ... </script> {% endblock %}
2 snippets posted so far.