name = request.POST.get('name', '')
part_name = request.POST.get('part_name', '')
+ project_data = request.POST.get('project', {})
+ project_description = project_data.get('description', '')
+ project_icon = project_data.get('icon', '')
+
_rest, slug = request.POST['book'].rstrip('/').rsplit('/', 1)
book = Book.objects.get(slug=slug)
bm.name = name
bm.part_name = part_name
bm.index = index
+ bm.project_description = project_description
+ bm.project_icon = project_icon
bm.file.save(None, request.data['file'], save=False)
bm.save(parts_count=parts_count)
--- /dev/null
+# Generated by Django 2.2.16 on 2021-03-16 13:46
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('catalogue', '0030_collection_role'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='bookmedia',
+ options={'ordering': ('type', 'index'), 'verbose_name': 'book media', 'verbose_name_plural': 'book media'},
+ ),
+ migrations.AddField(
+ model_name='bookmedia',
+ name='project_description',
+ field=models.CharField(blank=True, max_length=2048),
+ ),
+ migrations.AddField(
+ model_name='bookmedia',
+ name='project_icon',
+ field=models.CharField(blank=True, max_length=2048),
+ ),
+ ]
index = models.IntegerField(_('index'), default=0)
file = models.FileField(_('file'), max_length=600, upload_to=_file_upload_to, storage=OverwriteStorage())
uploaded_at = models.DateTimeField(_('creation date'), auto_now_add=True, editable=False, db_index=True)
+ project_description = models.CharField(max_length=2048, blank=True)
+ project_icon = models.CharField(max_length=2048, blank=True)
extra_info = models.TextField(_('extra information'), default='{}', editable=False)
book = models.ForeignKey('Book', models.CASCADE, related_name='media')
source_sha1 = models.CharField(null=True, blank=True, max_length=40, editable=False)
{% trans "Artist:" %} <span class='artist'>{{ extra_info.artist_name }}</span>,
{% trans "director:" %} <span class='director'>{{ extra_info.director_name }}</span>
{% if extra_info.license %}{% license_icon extra_info.license %}{% endif %}
+ {% if i.mp3.project_icon %}<img src="{{ i.mp3.project_icon }}">{% endif %}
<p>
+ {% if i.mp3.project_description %}{{ i.mp3.project_description }}{% else %}
{% with fb=extra_info.funded_by %}
{% if fb %}Dofinansowano ze środków: {{ fb }}.{% endif %}
{% endwith %}
+ {% endif %}
</p>
{% endwith %}
</div>