sql/update_db_00_03_to_00_04.2.py
author rougeronj
Wed, 06 Feb 2013 14:33:29 +0100
changeset 1092 3e00f8f4dc3c
parent 24 57a2650a7f87
permissions -rw-r--r--
init nb_segment to 0, to prevent error while making an empty research
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24
57a2650a7f87 update nyromodal
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
#! /usr/bin/env python
57a2650a7f87 update nyromodal
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
57a2650a7f87 update nyromodal
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
from django.core.management import setup_environ
57a2650a7f87 update nyromodal
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
from ldtplatform import settings
57a2650a7f87 update nyromodal
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
57a2650a7f87 update nyromodal
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
setup_environ(settings)
57a2650a7f87 update nyromodal
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
57a2650a7f87 update nyromodal
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
57a2650a7f87 update nyromodal
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
from ldt.ldt_utils.models import Media
57a2650a7f87 update nyromodal
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
57a2650a7f87 update nyromodal
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
for media in Media.objects.all():
57a2650a7f87 update nyromodal
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
    mimetype = media.mimetype
57a2650a7f87 update nyromodal
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
    if not media.mimetype_field and mimetye:
57a2650a7f87 update nyromodal
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
        media.mimetype_field = minetype
57a2650a7f87 update nyromodal
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
        media.save()