Счетчик
This commit is contained in:
1 parent
339f854494
commit
1b1220b9e7
11 files changed
+112
-80
No files matched your search
+22
-11
@@ -1,27 +1,38 @@
|
||||
from django.db import models
|
||||
from django.conf import settings
|
||||
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)
|
||||
visitdate = models.DateField()
|
||||
user = models.ForeignKey(User, null=True, blank=True, on_delete=models.PROTECT)
|
||||
count = models.IntegerField(default=0)
|
||||
fullPath = models.CharField(max_length=255)
|
||||
class Pages(models.Model):
|
||||
page = models.CharField(max_length=255)
|
||||
fullPath = models.CharField(max_length=255)
|
||||
ico = models.CharField(verbose_name='Иконка', max_length=150, null=True, blank=True)
|
||||
|
||||
def __str__(self):
|
||||
return str(self.page)
|
||||
return str(self.page)
|
||||
|
||||
|
||||
class CountVisitor(models.Model):
|
||||
# page = models.CharField(db_index=True, max_length=255)
|
||||
pages = models.ForeignKey(Pages, on_delete=models.PROTECT, related_name='get_pages', verbose_name='Страница', null=True)
|
||||
visitdate = models.DateField()
|
||||
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.PROTECT, verbose_name='Пользователь', null=True, blank=True)
|
||||
count = models.IntegerField(default=0)
|
||||
# fullPath = models.CharField(max_length=255)
|
||||
# ico = models.CharField(verbose_name='Иконка', max_length=150, null=True, blank=True)
|
||||
|
||||
def __str__(self):
|
||||
return str(self.pages)
|
||||
|
||||
|
||||
|
||||
class Meta:
|
||||
# class Meta:
|
||||
|
||||
|
||||
constraints = [
|
||||
models.UniqueConstraint(fields=['page', 'user', 'visitdate', 'fullPath', 'ico'], name='unique appversion')
|
||||
]
|
||||
# constraints = [
|
||||
# models.UniqueConstraint(fields=['page', 'user', 'visitdate', 'fullPath', 'ico'], name='unique appversion')
|
||||
# ]
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user