python - Count number of Views/Hits -


this question has answer here:

here's code,

class music(models.model):     visits = models.integerfield(default=0, blank=true)  def music(request)     ...... 

though it's not way of doing how can increase 'visits' +1 whenever view 'music' requested ?

please me, in advance!

although seems bit more needs, use though django-hitcount app. it's easy use , has more goodies: how long hit active, exclude hits users of specified group, possibility limit number of active hits single ip address, etc. (also has documentation).


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -