diff --git a/dandiapi/api/admin.py b/dandiapi/api/admin.py index fcad88ce4..700ff6152 100644 --- a/dandiapi/api/admin.py +++ b/dandiapi/api/admin.py @@ -232,5 +232,5 @@ class AssetAdmin(admin.ModelAdmin): @admin.register(Upload) class UploadAdmin(admin.ModelAdmin): - list_display = ['id', 'upload_id', 'blob', 'etag', 'upload_id', 'size', 'modified', 'created'] + list_display = ['id', 'upload_id', 'blob', 'etag', 'upload_id', 'size', 'created'] list_display_links = ['id', 'upload_id'] diff --git a/dandiapi/api/migrations/0044_remove_embargoedupload_modified_and_more.py b/dandiapi/api/migrations/0044_remove_embargoedupload_modified_and_more.py new file mode 100644 index 000000000..26982c597 --- /dev/null +++ b/dandiapi/api/migrations/0044_remove_embargoedupload_modified_and_more.py @@ -0,0 +1,31 @@ +# Generated by Django 4.1.11 on 2023-10-16 16:37 + +from django.db import migrations +import django_extensions.db.fields + + +class Migration(migrations.Migration): + dependencies = [ + ('api', '0043_asset_asset_metadata_no_computed_keys_or_published'), + ] + + operations = [ + migrations.RemoveField( + model_name='embargoedupload', + name='modified', + ), + migrations.RemoveField( + model_name='upload', + name='modified', + ), + migrations.AlterField( + model_name='embargoedupload', + name='created', + field=django_extensions.db.fields.CreationDateTimeField(auto_now_add=True), + ), + migrations.AlterField( + model_name='upload', + name='created', + field=django_extensions.db.fields.CreationDateTimeField(auto_now_add=True), + ), + ] diff --git a/dandiapi/api/models/upload.py b/dandiapi/api/models/upload.py index 723aa7a7f..5479e593e 100644 --- a/dandiapi/api/models/upload.py +++ b/dandiapi/api/models/upload.py @@ -6,7 +6,7 @@ from django.conf import settings from django.core.validators import RegexValidator from django.db import models -from django_extensions.db.models import TimeStampedModel +from django_extensions.db.models import CreationDateTimeField from dandiapi.api.storage import ( get_embargo_storage, @@ -19,13 +19,15 @@ from .dandiset import Dandiset -class BaseUpload(TimeStampedModel): +class BaseUpload(models.Model): ETAG_REGEX = r'[0-9a-f]{32}(-[1-9][0-9]*)?' class Meta: indexes = [models.Index(fields=['etag'])] abstract = True + created = CreationDateTimeField() + # This is the key used to generate the object key, and the primary identifier for the upload. upload_id = models.UUIDField(unique=True, default=uuid4, db_index=True) etag = models.CharField(