sql/update_db_00_03_to_00_04.2.py
author verrierj
Wed, 04 Jan 2012 17:28:54 +0100
changeset 330 806188af5027
parent 24 57a2650a7f87
permissions -rw-r--r--
Projects have an icon identical to one of the media they contain, if this icon is different from the default icon. Icons can be set using ./manage.py setprojecticon once icons have been added to contents.

#! /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()