From 944bc7d6c74ccdd31d574d36d68557c50814df57 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 21 Jan 2021 12:27:41 +0000 Subject: [PATCH] added stats log model --- stats/models.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/stats/models.py b/stats/models.py index 71a8362..bc7d827 100644 --- a/stats/models.py +++ b/stats/models.py @@ -1,3 +1,20 @@ -from django.db import models +from django.contrib.gis.db import models +from django.contrib.contenttypes.models import ContentType +from django.contrib.auth import get_user_model +User = get_user_model() # Create your models here. + +class StatsLog(models.Model): + + model = models.ForeignKey(ContentType, on_delete=models.DO_NOTHING, null=True) + user = models.ForeignKey(User, on_delete=models.DO_NOTHING, null=True) + anonymous = models.BooleanField('Usuario no registrado', null=True) + ip_address = models.GenericIPAddressField('IP usuario', null=True, blank=True) + geo = models.PointField('Ubicación aproximada', null=True, blank=True ) + contact = models.BooleanField('Empresa contactada', null=True) + shop = models.BooleanField('Redirigido por botón "Comprar"', null=True) + + # internal + created = models.DateTimeField('date of creation', auto_now_add=True) + updated = models.DateTimeField('date last update', auto_now=True)