Skip to content

Commit

Permalink
Bring in changes from @mattlindesay
Browse files Browse the repository at this point in the history
From #22

Copying in rather than dealing with merge because of the JSONField and migrations changes
  • Loading branch information
paltman committed Aug 15, 2020
1 parent 39a8151 commit 730c4b7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions pinax/eventlog/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 3.1 on 2020-08-15 09:54
# Generated by Django 3.1 on 2020-08-15 10:08

from django.conf import settings
import django.core.serializers.json
Expand All @@ -23,9 +23,9 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('timestamp', models.DateTimeField(db_index=True, default=django.utils.timezone.now)),
('action', models.CharField(db_index=True, max_length=50)),
('object_id', models.PositiveIntegerField(null=True)),
('extra', models.JSONField(encoder=django.core.serializers.json.DjangoJSONEncoder)),
('content_type', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='contenttypes.contenttype')),
('object_id', models.PositiveIntegerField(blank=True, null=True)),
('extra', models.JSONField(blank=True, encoder=django.core.serializers.json.DjangoJSONEncoder)),
('content_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='contenttypes.contenttype')),
('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
],
options={
Expand Down
6 changes: 3 additions & 3 deletions pinax/eventlog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ class Log(models.Model):
)
timestamp = models.DateTimeField(default=timezone.now, db_index=True)
action = models.CharField(max_length=50, db_index=True)
content_type = models.ForeignKey(ContentType, null=True, on_delete=models.SET_NULL)
object_id = models.PositiveIntegerField(null=True)
content_type = models.ForeignKey(ContentType, null=True, on_delete=models.SET_NULL, blank=True)
object_id = models.PositiveIntegerField(null=True, blank=True)
obj = GenericForeignKey("content_type", "object_id")
extra = models.JSONField(encoder=DjangoJSONEncoder)
extra = models.JSONField(encoder=DjangoJSONEncoder, blank=True)

@property
def template_fragment_name(self):
Expand Down

0 comments on commit 730c4b7

Please sign in to comment.