svetlyak40wt / django-counter
- Source
- Commits
- Network (2)
- Issues (0)
- Downloads (5)
- Wiki (1)
- Graphs
-
Branch:
master
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Mon May 25 07:50:02 -0700 2009 | |
| |
ChangeLog.rst | Mon Sep 21 21:58:51 -0700 2009 | |
| |
LICENSE | Mon May 25 07:50:02 -0700 2009 | |
| |
MANIFEST.in | Wed May 27 08:29:31 -0700 2009 | |
| |
Makefile | Mon May 25 07:50:02 -0700 2009 | |
| |
README.rst | Wed May 27 03:27:03 -0700 2009 | |
| |
buildout.cfg | Tue May 26 06:28:11 -0700 2009 | |
| |
docs/ | Mon May 25 07:50:02 -0700 2009 | |
| |
setup.py | Wed May 27 03:30:24 -0700 2009 | |
| |
src/ | Mon Sep 21 21:55:53 -0700 2009 | |
| |
update_buildout.sh | Mon Sep 07 13:25:14 -0700 2009 |
Introduction
This is a general purpose page views / redirects counter for django projects.
Dependencies
This application depends on PIL.
Installation
- Add application django_counter to the INSTALLED_APPS list.
- Add to urlpatterns: (r'^count/', include('django_counter.urls'))
- Run ./manage.py syncdb to create all neccessary tables.
Usage
View counter
View counter is linked to particular object. First, you need to add and img element on the page with object:
{% load counter_tags %} {% counter object %}
The second line add an invisible image on the page. When browser gets this image, counter is incremented.
Next, you if you need to output a total number of page views somewhere, add these lines in your template:
{% load counter_tags %} {% view_count for blog.entry object.id as page_views %} <p>Object viewed: {{ page_views }} times.</p>
Redirects counter
To use redirect counter, create one through admin interface and put anywhere link to a redirector. It can look like http://example.com/counter/r/123/.
After that, you can collect redirects and referers statistic in the admin interface.
Contacts
Author: Alexander Artemenko
Please send any suggesions and patches to svetlyak.40wt at google mail, or to http://github.com/svetlyak40wt/django-counter/
