Django hit counter

Submitted 5 years ago
Ticket #19
Views 513
Language/Framework Django
Priority High
Status Closed

Hi, I want to create a website visitors counter where it shows on the website how many users visits the website. Please help

Submitted on Jun 08, 20
add a comment

1 Answer

Acknowledged

Submitted 5 years ago

do you want to use third party library or interested to create your own logic to handle it?

- scott 5 years ago

I want to create using own logic. Not interested on using third party

- janice10sombillo 5 years ago

In that case, you can start exploring of creating your own mixins using ContentType

- scott 5 years ago

Just an example, you can create model to store the user viewed object details in that model, step 2 create the MIXIN and step 3 . add the mixin to your detailed view. For example, you can create the models like this using *ContentType * class ObjectViewed(models.Model): user = models.ForeignKey(User, blank=True, null=True, on_delete=models.SET_NULL) content_type = models.ForeignKey(ContentType, blank=True, null=True, on_delete=models.SET_NULL) object_id = models.PositiveIntegerField() content_object = GenericForeignKey('content_type', 'object_id') timestamp = models.DateTimeField(auto_now_add=True)

- scott 5 years ago

check this for more reference ContentType

- scott 5 years ago

Im just new to django can you you show some sample or demo please ive been finding a solution for almost a week. Thanks

- janice10sombillo 5 years ago

i have already shared the example of how to create it.i would suggest try from your end as you are new to Django. This is not beginner topic. So try from your end using example which i sent. If you still stuck , let me know , i will setup a meeting with you.

- scott 5 years ago

I'm still stuck. Is there a tutorial on how can I make visitors counter? sorry im so confused

- janice10sombillo 5 years ago

even if we show you demo also it will be hard , because this is little advance concept. Thats why we suggest you to get the better understanding of BASIC and start implement this.

- Vengat 5 years ago

check this if it helps, https://youtu.be/bEEFo75IkYU

- scott 5 years ago

As we didnt get any update on this. We are closing the ticket from our end.

- Vengat 4 years, 12 months ago


Latest Blogs