django-hitcount icon indicating copy to clipboard operation
django-hitcount copied to clipboard

Support for project with multiple Site ID

Open Ione03 opened this issue 2 years ago • 0 comments

I make a project with multiple domain and only one ip address. How can i get hit count information from one domain and another. May be we need additional field to model Hit, something like this :

class Hit(models.Model):
    created = models.DateTimeField(editable=False, auto_now_add=True,
        db_index=True)
    ip = models.CharField(max_length=40, editable=False, db_index=True)
    session = models.CharField(max_length=40, editable=False, db_index=True)
    user_agent = models.CharField(max_length=255, editable=False)    
    user = models.ForeignKey(AUTH_USER_MODEL, null=True, editable=False,
        on_delete=models.CASCADE)
    hitcount = models.ForeignKey(MODEL_HITCOUNT, editable=False, on_delete=
        models.CASCADE)

    # Additional Field
    domain = models.CharField(max_length=255, editable=False, default='')
    

And domain can be save using :

domain=request.get_host()

Ione03 avatar Mar 23 '22 03:03 Ione03