def METHOD_NAME(cls, user, course: Course):
    obj, created = cls.objects.get_or_create(user=user, course=course)
    if not created and (timezone.now() - obj.last_view) > timedelta(minutes=5):
        # Do not use F("views") + 1 here as we DO want a race condition to happen.
        # Indeed, if the user loads 2 pages at the same instant, we want to count only
        # one of them (as we count a new page view every 5 min only)
        obj.views = obj.views + 1
        obj.save()