def handle(self, *app_labels, **options): print "WARNING: Deleting ALL XML FILES, SUBMISSIONS, AND SCHEMA from the local server!" # print "WARNING: Deleting all saved xforms, schemas, and instance data." verbose = options.get("verbose", True) if verbose: rest_util.are_you_sure() reset_schema()
def handle(self, *app_labels, **options): print "WARNING: Deleting ALL SUBMISSIONS from the local server!" # print "WARNING: Deleting all saved xforms, schemas, and instance data." verbose = options.get('verbose', True) if verbose: rest_util.are_you_sure() reset_submits()
def get_form_and_domain(self, **options): domain_name = options.get("domain_name") form_id = options.get("form_id") form = None domain = None # get the form if form_id: try: form = FormDefModel.objects.get(id=form_id) except FormDefModel.DoesNotExist: print ("ERROR. No form with ID %s found. If you'd like to " + \ "include all forms or all forms in a domain then leave " + \ "this parameter blank") % form_id sys.exit() # get the domain if domain_name: try: domain = Domain.objects.get(name__iexact=domain_name) domains = [domain] except Domain.DoesNotExist: print ("ERROR! No domain with name '%s' found. Known domains are: %s. " + \ "You can also leave this blank to include all domains.") % \ (domain_name, ", ".join(Domain.objects.values_list("name", flat=True))) sys.exit() if form and domain and form.domain != domain: print ("Warning! The form you specified (%s) is not in the domain you specified (%s). " +\ "Would you like to go ahead with this anyways?") % (form, domain.name) rest_util.are_you_sure() return [form, domain]
def handle(self, *args, **options): if len(args) < 3: raise CommandError('Please specify %s.' % self.label) remote_ip = args[0] username = args[1] password = args[2] local_dns = "127.0.0.1:8000" if len(args) == 4: local_dns = args[3] print "This script assumes a local server is running. " + \ "To launch your local server, run './manage.py runserver'" rest_util.are_you_sure() synchronize_builds(remote_ip, username, password, local_dns)
def handle(self, *args, **options): if len(args) < 1: raise CommandError("Please specify %s." % self.label) submissions = args[0] local_dns = None if len(args) == 2: local_dns = args[1] print "WARNING: Loading new data" rest_util.are_you_sure() if local_dns: load_submissions(submissions, local_dns) else: load_submissions(submissions)
def handle(self, *args, **options): if len(args) < 3: raise CommandError('Please specify %s.' % self.label) remote_ip = args[0] username = args[1] password = args[2] local_dns = None if len(args) == 4: local_dns = args[3] verbose = options.get('verbose', True) debug = options.get('debug', False) if verbose: print "This script assumes a local server is running. " + \ "To launch your local server, run './manage.py runserver'" rest_util.are_you_sure() file = "schemata.tar" generate_schemata(remote_ip, username, \ password, download=True, to=file, debug=False) if local_dns: load_schemata(file, local_dns) else: load_schemata(file)