diff --git a/django_visit_count/mixins.py b/django_visit_count/mixins.py index 777053e..886d48d 100644 --- a/django_visit_count/mixins.py +++ b/django_visit_count/mixins.py @@ -15,3 +15,8 @@ def count_visit(self, request, session_duration=VISIT_COUNT_DEFAULT_SESSION_DURA if is_new_visit(request, self, session_duration=session_duration): self.visit_count = models.F("visit_count") + 1 self.save(update_fields=["visit_count"]) + + def reset_visits(self, save=True): + self.visit_count = 0 + if save: + self.save(update_fields=["visit_count"]) diff --git a/setup.py b/setup.py index c62b260..29b870b 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ setup( name="django-visit-count", - version="1.1.0", + version="1.1.1", description="Count visits using cache for Django models", long_description=README, long_description_content_type="text/markdown",