-from archive.models import Project, Audiobook, Piece, License
+from archive.models import Project, Audiobook, License
from django.contrib import admin
admin.site.register(Project)
admin.site.register(Audiobook, AudiobookAdmin)
-admin.site.register(Piece)
admin.site.register(License)
--- /dev/null
+# Generated by Django 3.1.2 on 2021-03-16 14:06
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('archive', '0021_merge_20210121_1251'),
+ ]
+
+ operations = [
+ migrations.DeleteModel(
+ name='Piece',
+ ),
+ migrations.AddField(
+ model_name='project',
+ name='icon',
+ field=models.FileField(blank=True, null=True, upload_to='archive/project'),
+ ),
+ ]
sponsors = models.TextField(blank=True, null=True, verbose_name="Sponsorzy")
description = models.TextField(blank=True, verbose_name="Opis")
youtube = models.ForeignKey('youtube.YouTube', models.PROTECT)
+ icon = models.FileField(upload_to='archive/project', blank=True, null=True)
class Meta:
verbose_name = _("project")
)
-class Piece(models.Model):
- name = models.CharField(max_length=255)
- source_file = models.FileField(upload_to='piece')
- is_outro = models.BooleanField(default=False)
- min_audiobook_duration = models.IntegerField(default=0)
-
- def __str__(self):
- return self.name
-
-
def source_upload_to(intance, filename):
return os.path.join(FILES_SAVE_PATH, filename) # FIXME: what about really long file names?
'part_index': audiobook.index,
'parts_count': audiobook.parts_count,
'source_sha1': audiobook.source_sha1,
+
+ 'project': {
+ 'description': audiobook.project.get_description(),
+ 'icon': audiobook.project.icon.url,
+ }
}
with open(path, 'rb') as f:
api_call(user, UPLOAD_URL, data=data, files={