Skip to content

Commit

Permalink
Remove unused modified field on Upload model
Browse files Browse the repository at this point in the history
  • Loading branch information
mvandenburgh committed Oct 16, 2023
1 parent d68207c commit ece150e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dandiapi/api/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Original file line number Diff line number Diff line change
@@ -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),
),
]
6 changes: 4 additions & 2 deletions dandiapi/api/models/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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(
Expand Down

0 comments on commit ece150e

Please sign in to comment.