OpenSlides/server/openslides/mediafiles/migrations/0008_external_storage_2.py
FinnStutzenstein 2bcab5d098
Repository restructure
- moved all server related things into the folder `server`, so this
configuration is parallel to the client.
- All main "services" are now folders in the root directory
- Added Dockerfiles to each service (currently server and client)
- Added a docker compose configuration to start everything together.
Currently there are heavy dependencies into https://github.com/OpenSlides/openslides-docker-compose
- Resturctured the .gitignore. If someone needs something excluded,
please add it to the right section.
- Added initial build setup with Docker and docker-compose.
- removed setup.py. We won't deliver OpenSlides via pip anymore.
2020-08-21 08:11:13 +02:00

29 lines
933 B
Python

# Generated by Django 2.2.8 on 2019-12-11 14:12
import mimetypes
from django.db import migrations
from ..utils import bytes_to_human, get_pdf_information
def fill_new_values(apps, schema_editor):
Mediafile = apps.get_model("mediafiles", "Mediafile")
for mediafile in Mediafile.objects.all():
if not mediafile.is_directory:
mediafile.filesize = bytes_to_human(mediafile.mediafile.size)
mediafile.mimetype = mimetypes.guess_type(mediafile.mediafile.name)[0]
if mediafile.mimetype == "application/pdf":
mediafile.pdf_information = get_pdf_information(mediafile.mediafile)
else:
mediafile.pdf_information = {}
mediafile.save(skip_autoupdate=True)
class Migration(migrations.Migration):
dependencies = [
("mediafiles", "0007_external_storage_1"),
]
operations = [migrations.RunPython(fill_new_values)]