2012-08-28 22:56:32 +02:00
|
|
|
from django.core.management.base import NoArgsCommand
|
|
|
|
|
|
|
|
from django.contrib.auth.models import User
|
2012-09-07 19:36:41 +02:00
|
|
|
from zephyr.models import Zephyr, UserProfile, ZephyrClass, Recipient
|
2012-08-28 22:56:32 +02:00
|
|
|
from django.contrib.sessions.models import Session
|
|
|
|
|
|
|
|
class Command(NoArgsCommand):
|
|
|
|
help = "Clear only tables we change: zephyr + sessions"
|
|
|
|
|
|
|
|
def handle_noargs(self, **options):
|
|
|
|
for klass in [Zephyr, ZephyrClass, UserProfile, User, Recipient]:
|
|
|
|
klass.objects.all().delete()
|
|
|
|
Session.objects.all().delete()
|
|
|
|
|
|
|
|
self.stdout.write("Successfully cleared the database.\n")
|