Skip to content

Commit

Permalink
Update cedarmetadatatemplate model and redo migration
Browse files Browse the repository at this point in the history
  • Loading branch information
cslzchen committed Dec 8, 2023
1 parent 232d71b commit 82edf2f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 33 deletions.
7 changes: 4 additions & 3 deletions osf/migrations/0017_cedarmetadatatemplate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 3.2.17 on 2023-11-13 18:01
# Generated by Django 3.2.17 on 2023-12-08 17:06

from django.db import migrations, models
import django_extensions.db.fields
Expand All @@ -20,13 +20,14 @@ class Migration(migrations.Migration):
('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')),
('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')),
('_id', models.CharField(db_index=True, default=osf.models.base.generate_object_id, max_length=24, unique=True)),
('title', models.CharField(max_length=255)),
('schema_name', models.CharField(default=None, max_length=255)),
('cedar_id', models.CharField(default=None, max_length=255)),
('template', osf.utils.datetime_aware_jsonfield.DateTimeAwareJSONField(default=dict, encoder=osf.utils.datetime_aware_jsonfield.DateTimeAwareJSONEncoder)),
('active', models.BooleanField(default=True)),
('template_version', models.PositiveIntegerField()),
],
options={
'unique_together': {('title', 'template_version')},
'unique_together': {('cedar_id', 'template_version')},
},
bases=(models.Model, osf.models.base.QuerySetExplainMixin),
),
Expand Down
27 changes: 0 additions & 27 deletions osf/migrations/0018_auto_20231129_1429.py

This file was deleted.

7 changes: 4 additions & 3 deletions osf/models/cedar_metadata.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from django.db import models

from osf.models.base import BaseModel, ObjectIDMixin
from osf.utils.datetime_aware_jsonfield import DateTimeAwareJSONField
from .base import BaseModel, ObjectIDMixin


class CedarMetadataTemplate(ObjectIDMixin, BaseModel):
title = models.CharField(max_length=255, default=None)
schema_name = models.CharField(max_length=255, default=None)
cedar_id = models.CharField(max_length=255, default=None)
template = DateTimeAwareJSONField(default=dict)
active = models.BooleanField(default=True)
Expand All @@ -14,4 +15,4 @@ class Meta:
unique_together = ('cedar_id', 'template_version')

def __unicode__(self):
return f'({self.title}, version {self.tempate_version})'
return f'(name=[{self.schema_name}], version=[{self.template_version}], id=[{self.cedar_id}])'

0 comments on commit 82edf2f

Please sign in to comment.