sql/update_db_00_03_to_00_04.2.py
author verrierj
Thu, 02 Feb 2012 17:43:40 +0100
changeset 516 1166fb6bc9b4
parent 24 57a2650a7f87
permissions -rw-r--r--
Merge with 8fb2523b9c74b1d926a1df9f575fbb82cf315a49
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()