sql/update_db_00_03_to_00_04.2.py
author ymh <ymh.work@gmail.com>
Sat, 11 May 2013 23:09:05 +0200
changeset 1180 54ef33bb4065
parent 24 57a2650a7f87
permissions -rw-r--r--
Merge with eb9cc63ce7423fe953f6332fd7f28624e5840ef3
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()