Skip to content

Commit

Permalink
Fix object_pk field
Browse files Browse the repository at this point in the history
  • Loading branch information
MotasemAghbar committed May 21, 2020
1 parent 2581ba6 commit d9e8613
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions hitcount/migrations/0004_auto_2020215_2004.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.0.3 on 2019-06-08 10:04

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('hitcount', '0002_index_ip_and_session'),
]

operations = [
migrations.AlterField(
model_name='hitcount',
name='object_pk',
field=models.PositiveIntegerField(verbose_name='object ID'),
),
]
2 changes: 1 addition & 1 deletion hitcount/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class HitCount(models.Model):
modified = models.DateTimeField(auto_now=True)
content_type = models.ForeignKey(
ContentType, related_name="content_type_set_for_%(class)s", on_delete=models.CASCADE)
object_pk = models.TextField('object ID')
object_pk = models.PositiveIntegerField('object ID')
content_object = GenericForeignKey('content_type', 'object_pk')

objects = HitCountManager()
Expand Down

2 comments on commit d9e8613

@bashu
Copy link

@bashu bashu commented on d9e8613 Dec 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bashu
Copy link

@bashu bashu commented on d9e8613 Dec 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can simply override object_pk in your MyHitCount model

Please sign in to comment.