How to use the watchtower.models.Hit.objects.using function in watchtower

To help you get started, we’ve selected a few watchtower examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github synw / django-watchtower / watchtower / db / orm / __init__.py View on Github external
is_touch=convertBool(hit["ua"]["is_touch"]),
            browser=hit["ua"]["browser"],
            device=hit["ua"]["device"],
            country=hit["geo"]["country_name"],
            latitude=float(hit["geo"]["latitude"]),
            longitude=float(hit["geo"]["longitude"]),
            region=hit["geo"]["region"],
            city=hit["geo"]["city"]
        )
        hit_objs.append(hit_obj)
    if verbosity == 1:
        if i > 0:
            print(i, "hits")
    elif verbosity > 1:
        print(i, "hits")
    Hit.objects.using(db).bulk_create(hit_objs)
    return i