Skip to content

Commit

Permalink
If DEMO is set to false, reset_demo_account raise an error.
Browse files Browse the repository at this point in the history
  • Loading branch information
fgaudin committed May 10, 2011
1 parent 24f4345 commit 1327e99
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/management/commands/reset_demo_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from django.contrib.auth.models import User
import datetime
from project.models import Project, PROJECT_STATE_FINISHED, \
PROJECT_STATE_PROPOSAL_ACCEPTED, PROJECT_STATE_PROPOSAL_SENT, Proposal, \
PROJECT_STATE_PROPOSAL_ACCEPTED, Proposal, \
PROPOSAL_STATE_DRAFT, PROPOSAL_STATE_BALANCED, ProposalRow, \
ROW_CATEGORY_SERVICE, PROJECT_STATE_STARTED, PROPOSAL_STATE_ACCEPTED, \
PROJECT_STATE_PROSPECT
Expand All @@ -19,13 +19,16 @@
from accounts.models import InvoiceRow, Invoice, INVOICE_STATE_PAID, \
PAYMENT_TYPE_CHECK, Expense, PAYMENT_TYPE_BANK_CARD, INVOICE_STATE_SENT, \
INVOICE_STATE_EDITED
from django.db import connection, transaction, connections, DEFAULT_DB_ALIAS, models
from django.db import connection, transaction, models
from django.core.management.color import no_style

class Command(BaseCommand):
help = "Reset data for demo account"

def handle(self, *args, **options):
if not settings.DEMO:
self.stderr.write("Demo is set to False\n")

for profile in UserProfile.objects.all():
shutil.rmtree('%s%s' % (settings.FILE_UPLOAD_DIR,
profile.uuid),
Expand Down

0 comments on commit 1327e99

Please sign in to comment.