sql/update_db_00_03_to_00_04.2.py
author cavaliet
Thu, 11 Apr 2013 10:13:43 +0200
changeset 1143 70cb0d4fd6cc
parent 24 57a2650a7f87
permissions -rw-r--r--
correct reindex parameter
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()