# HG changeset patch # User cavaliet # Date 1395672018 -3600 # Node ID cb2563f5acdb3dd50d0110a18b78c2ec1dcaaa61 # Parent 231ead74131a270c05e6c3cf1525cf8aba3c7009 usefull command to empty db : remove_ldt_utils_objects diff -r 231ead74131a -r cb2563f5acdb src/spel/management/commands/remove_ldt_utils_objects.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/spel/management/commands/remove_ldt_utils_objects.py Mon Mar 24 15:40:18 2014 +0100 @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +''' +Created on Mar 22, 2013 + +@author: tc +''' + +from datetime import datetime +from dircache import listdir +from django.core.management import call_command +from django.core.management.base import BaseCommand, CommandError +from genericpath import isdir, isfile +from ldt.api.ldt.serializers.cinelabserializer import CinelabSerializer +from ldt.ldt_utils.models import Segment, Project, Content, Media +from ldt.ldt_utils.utils import generate_uuid +from ldt.security import set_current_user, get_current_user_or_admin +from ldt.security.cache import cached_assign +from optparse import make_option +from os.path import join +import json +import lxml.etree +import os.path + +import logging +from ldt.ldt_utils.stat import update_stat_content +from tagging.models import Tag +logger = logging.getLogger(__name__) + + +class Command(BaseCommand): + + def handle(self, *args, **options): + + Project.objects.all().delete() + Content.objects.all().delete() + Media.objects.all().delete() + Segment.objects.all().delete() + Tag.objects.all().delete() + + # This is the end + print("This is the end") + + \ No newline at end of file