27 lines
1.3 KiB
Python
27 lines
1.3 KiB
Python
from django.db import models
|
|
from accounts.models import User
|
|
# Create your models here.
|
|
import pandas as pd
|
|
|
|
class CountVisitor(models.Model):
|
|
page = models.CharField(db_index=True, max_length=255, db_comment = 'Имя посещенной страницы')
|
|
visitdate = models.DateField()
|
|
user = models.ForeignKey(User, null=True, blank=True, on_delete=models.PROTECT, db_comment = 'Пользователь посетевший страницу')
|
|
count = models.IntegerField(default=0, db_comment = 'Количество посещений')
|
|
fullPath = models.CharField(max_length=255, db_comment = 'Полный путь страницы')
|
|
ico = models.CharField(verbose_name='Иконка', max_length=150, null=True, blank=True, db_comment = 'Иконка для отображения количества посещений на Портале')
|
|
|
|
def __str__(self):
|
|
return str(self.page)
|
|
|
|
|
|
|
|
class Meta:
|
|
db_table_comment = "Портал. Таблица посещенных страниц. Сбор и хранение информации о посещенных пользователями страниц Портала"
|
|
|
|
constraints = [
|
|
models.UniqueConstraint(fields=['page', 'user', 'visitdate', 'fullPath', 'ico'], name='unique appversion')
|
|
]
|
|
|
|
|
|
|