Skip to content
This repository was archived by the owner on May 23, 2020. It is now read-only.

Commit f94fa42

Browse files
committed
Update model to Tracking hit Counter for post
1 parent 5e7f87a commit f94fa42

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

update-1.1/blog/models.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from django.core.urlresolvers import reverse
44
from ckeditor.fields import RichTextField
55
from ckeditor_uploader.fields import RichTextUploadingField
6+
import datetime
67

78
class EntryQuerySet(models.QuerySet):
89
def published(self):
@@ -142,3 +143,16 @@ class Meta:
142143
verbose_name = "Blog Page"
143144
verbose_name_plural = "Blog Pages"
144145
ordering = ["-created"]
146+
147+
148+
class Entry_Views(models.Model):
149+
entry = models.ForeignKey(Entry, related_name='entry_views')
150+
ip = models.CharField(max_length=40)
151+
session = models.CharField(max_length=40, null=True)
152+
created = models.DateTimeField(default=datetime.datetime.now())
153+
154+
def __unicode__(self):
155+
return self.entry.title
156+
157+
class Meta:
158+
verbose_name_plural = "Entry Views"

0 commit comments

Comments
 (0)