-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support uploading model runs from the web client
- Loading branch information
Showing
15 changed files
with
615 additions
and
74 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Generated by Django 5.0.8 on 2024-08-14 21:17 | ||
|
||
import uuid | ||
|
||
import s3_file_field.fields | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
('core', '0032_siteevaluation_point_siteobservation_point_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='ModelRunUpload', | ||
fields=[ | ||
( | ||
'id', | ||
models.UUIDField( | ||
default=uuid.uuid4, | ||
editable=False, | ||
primary_key=True, | ||
serialize=False, | ||
), | ||
), | ||
('title', models.CharField(max_length=1000)), | ||
( | ||
'private', | ||
models.BooleanField( | ||
default=False, | ||
help_text='Whether this model run should be private', | ||
), | ||
), | ||
( | ||
'region', | ||
models.CharField( | ||
blank=True, | ||
help_text='Override for the region this model run belongs to', | ||
max_length=1000, | ||
), | ||
), | ||
( | ||
'performer', | ||
models.CharField( | ||
blank=True, | ||
help_text='Override for the team that produced this evaluation', | ||
max_length=1000, | ||
), | ||
), | ||
('zipfile', s3_file_field.fields.S3FileField()), | ||
( | ||
'task_id', | ||
models.CharField(help_text='celery task ID', max_length=128), | ||
), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from uuid import uuid4 | ||
|
||
from s3_file_field import S3FileField | ||
|
||
from django.db import models | ||
from django.db.models.signals import pre_delete | ||
from django.dispatch import receiver | ||
|
||
|
||
class ModelRunUpload(models.Model): | ||
id = models.UUIDField(primary_key=True, default=uuid4, editable=False) | ||
|
||
title = models.CharField(max_length=1000) | ||
private = models.BooleanField( | ||
default=False, help_text='Whether this model run should be private' | ||
) | ||
region = models.CharField( | ||
max_length=1000, | ||
blank=True, | ||
help_text='Override for the region this model run belongs to', | ||
) | ||
performer = models.CharField( | ||
max_length=1000, | ||
blank=True, | ||
help_text='Shortcode override for the team that produced this evaluation', | ||
) | ||
zipfile = S3FileField() | ||
|
||
task_id = models.CharField(max_length=256, help_text='Celery task ID') | ||
|
||
def __str__(self) -> str: | ||
return f'<ModelRunUpload {self.id}>' | ||
|
||
|
||
@receiver(pre_delete, sender=ModelRunUpload) | ||
def delete_zipfile(sender, instance, **kwargs): | ||
if instance.zipfile: | ||
instance.zipfile.delete(save=False) |
Oops, something went wrong.