Skip to content

Commit

Permalink
For future use, also store who created each query and when (#486)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgonggrijp committed Jul 8, 2021
1 parent 6205a5f commit bf3d142
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
28 changes: 28 additions & 0 deletions backend/items/migrations/0005_auto_20210708_1249.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 2.0.13 on 2021-07-08 10:49

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('items', '0004_semanticquery'),
]

operations = [
migrations.AddField(
model_name='semanticquery',
name='created',
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
preserve_default=False,
),
migrations.AddField(
model_name='semanticquery',
name='creator',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL),
),
]
5 changes: 5 additions & 0 deletions backend/items/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.db import models
from django.contrib.postgres.fields import JSONField
from django.conf import settings

from rdf.baseclasses import BaseCounter
from .constants import ITEMS_NS, ITEMS_HISTORY_NS
Expand All @@ -16,6 +17,10 @@ class EditCounter(BaseCounter):
class SemanticQuery(models.Model):
label = models.CharField(blank=True, max_length=100)
query = JSONField()
creator = models.ForeignKey(
settings.AUTH_USER_MODEL, null=True, on_delete=models.SET_NULL,
)
created = models.DateTimeField(auto_now_add=True)

def __str__(self):
return self.label or str(self.id)

0 comments on commit bf3d142

Please sign in to comment.