sql/update_db_00_03_to_00_04.2.py
author grandjoncl
Thu, 20 Dec 2012 15:22:42 +0100
branchmodifications_relative_ldtxml
changeset 1044 e3902e1bd785
parent 24 57a2650a7f87
permissions -rw-r--r--
modifications to have relative src for media in the xml ldt of a project. - Migration in order to set all the project ldt with the new values in the xml. If the media has a content that doesn't exist, the media is erased. If the project has no valid media, the project is deleted. There is a test in project_tests. - The migration uses the command : set_projectldtiri - The command set_projectldtiri uses the function in utils relative_src_xml that returns an xml. The command deletes the projects that have no ldt or the ldt isn't valid (empty string) - Modifications in lignesdetemps to have absolute urls in the xml when we open a project or in the research when we display the results in lignes de temps

#! /usr/bin/env python

from django.core.management import setup_environ
from ldtplatform import settings

setup_environ(settings)


from ldt.ldt_utils.models import Media

for media in Media.objects.all():
    mimetype = media.mimetype
    if not media.mimetype_field and mimetye:
        media.mimetype_field = minetype
        media.save()