Exposed ExperimentKeyValue model in Django admin

The model data can now be viewed/managed via Django admin. Additionally, the verbose name of the model has been corrected.
This commit is contained in:
Clinton Blackburn
2017-07-13 11:51:58 -04:00
committed by Clinton Blackburn
parent eadc099512
commit 2eea7606a3
3 changed files with 30 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
from django.contrib import admin
from .models import ExperimentData
from .models import ExperimentData, ExperimentKeyValue
@admin.register(ExperimentData)
@@ -11,3 +11,12 @@ class ExperimentDataAdmin(admin.ModelAdmin):
raw_id_fields = ('user',)
readonly_fields = ('created', 'modified',)
search_fields = ('experiment_id', 'user', 'key',)
@admin.register(ExperimentKeyValue)
class ExperimentKeyValueAdmin(admin.ModelAdmin):
list_display = ('experiment_id', 'key',)
list_filter = ('experiment_id',)
ordering = ('experiment_id', 'key',)
readonly_fields = ('created', 'modified',)
search_fields = ('experiment_id', 'key',)

View File

@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('experiments', '0002_auto_20170627_1402'),
]
operations = [
migrations.AlterModelOptions(
name='experimentkeyvalue',
options={'verbose_name': 'Experiment Key-Value Pair', 'verbose_name_plural': 'Experiment Key-Value Pairs'},
),
]

View File

@@ -30,8 +30,8 @@ class ExperimentKeyValue(TimeStampedModel):
value = models.TextField()
class Meta(object):
verbose_name = 'Experiment Data'
verbose_name_plural = 'Experiment Data'
verbose_name = 'Experiment Key-Value Pair'
verbose_name_plural = 'Experiment Key-Value Pairs'
unique_together = (
('experiment_id', 'key'),
)