Files
PORTAL_COD2/back/watcher/models.py
T

17 lines
560 B
Python

from django.db import models
from accounts.models import User
# Create your models here.
class CountVisitor(models.Model):
page = models.CharField(db_index=True, max_length=255)
visitdate = models.DateField()
user = models.ForeignKey(User, null=True, blank=True, on_delete=models.PROTECT)
count = models.IntegerField(default=0)
def __str__(self):
return str(self.page)
class Meta:
constraints = [
models.UniqueConstraint(fields=['page', 'user', 'visitdate'], name='unique appversion')
]