Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def count_hits(func):
- def decorated(request, *args, **kwargs):
- # ... find object and update hit count for it...
- return func(request, *args, **kwargs)
- return decorated
- @count_hits
- def detail_view(...
- url(r'^/blog/post...', count_hits(detail_view))
- class Hit(models.Model):
- date = models.DateTimeFiles(auto_now=True)
- content_type = models.ForeignKey(ContentType)
- object_id = models.PositiveIntegerField()
- content_object = generic.GenericForeignKey('content_type', 'object_id')
- def render_to_response_hit_count(request,template_path,keys,response):
- for key in keys:
- for i in response[key]:
- Hit(content_object=i).save()
- return render_to_response(template_path, response)
- return render_to_response_hit_count(request, 'map/list.html',['list',],
- {
- 'list': l,
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement