def _get_logged_in_user(self): tenant = TenantFactory() current_user = get_current_user() # Ugly! if current_user: current_user.tenant = tenant user = LilyUserFactory(tenant=tenant) user.set_password('test') user.save() self.client.login(username=user.primary_email.email_address, password='******') return user
def handle(self, *args, **options): batch_size = int(options['batch_size']) targets = options['target'] tenantOption = options['tenant'].strip() if not tenantOption: tenant = TenantFactory() else: tenant = Tenant.objects.get(pk=int(tenantOption)) for target in targets.split(','): getattr(self, target)(batch_size, tenant) self.stdout.write('Done running "%s" with batch size %s in %s.' % (targets, batch_size, tenant))
def handle(self, *args, **options): self.batch_size = int(options['batch_size']) self.target = options['target'].strip() if self.target not in self.target_choices: raise CommandError( 'Unknown target specified, please only use one of the following:\n' ' %s' % "\n ".join(self.target_choices)) tenant_id = options['tenant'].strip() if tenant_id: self.tenant = Tenant.objects.get(pk=int(tenant_id)) else: self.tenant = TenantFactory() getattr(self, self.target)() self.stdout.write('Done running "%s" with batch size %s in %s.' % (self.target, self.batch_size, self.tenant))