|
@ -4,7 +4,7 @@ import datetime |
|
|
import os |
|
|
import os |
|
|
import random |
|
|
import random |
|
|
|
|
|
|
|
|
from django.core.management.base import NoArgsCommand |
|
|
from django.core.management.base import BaseCommand |
|
|
from django.core.management import call_command |
|
|
from django.core.management import call_command |
|
|
from django.conf import settings |
|
|
from django.conf import settings |
|
|
|
|
|
|
|
@ -14,10 +14,10 @@ import django.contrib.auth |
|
|
User = django.contrib.auth.get_user_model() |
|
|
User = django.contrib.auth.get_user_model() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Command(NoArgsCommand): |
|
|
class Command(BaseCommand): |
|
|
help = "Clear database and load testing data." |
|
|
help = "Clear database and load testing data." |
|
|
|
|
|
|
|
|
def handle_noargs(self, **options): |
|
|
def handle(self, **options): |
|
|
assert settings.DEBUG == True |
|
|
assert settings.DEBUG == True |
|
|
dbfile = settings.DATABASES['default']['NAME'] |
|
|
dbfile = settings.DATABASES['default']['NAME'] |
|
|
if os.path.exists(dbfile): |
|
|
if os.path.exists(dbfile): |
|
|