def setUp(self): if 'south' in settings.INSTALLED_APPS: from south.management.commands.migrate import Command command = Command() command.handle(all_apps=True) self.templates = [ ("{% node_url %}", "/root/second/"), ("{% node_url for node2 %}", "/root/second2/"), ("{% node_url as hello %}<p>{{ hello|slice:'1:' }}</p>", "<p>root/second/</p>"), ("{% node_url for nodes|first %}", "/root/"), ("{% node_url with entry %}", settings.TEMPLATE_STRING_IF_INVALID), ("{% node_url with entry for node2 %}", "/root/second2/2010/10/20/first-entry"), ("{% node_url with tag for node2 %}", "/root/second2/tags/test-tag/"), ("{% node_url with date for node2 %}", "/root/second2/2010/10/20"), ("{% node_url entries_by_day year=date|date:'Y' month=date|date:'m' day=date|date:'d' for node2 as goodbye %}<em>{{ goodbye|upper }}</em>", "<em>/ROOT/SECOND2/2010/10/20</em>"), ("{% node_url entries_by_month year=date|date:'Y' month=date|date:'m' for node2 %}", "/root/second2/2010/10"), ("{% node_url entries_by_year year=date|date:'Y' for node2 %}", "/root/second2/2010/"), ] nodes = Node.objects.all() blog = Blog.objects.all()[0] self.context = template.Context({ 'node': nodes.get(slug='second'), 'node2': nodes.get(slug='second2'), 'nodes': nodes, 'entry': BlogEntry.objects.all()[0], 'tag': blog.entry_tags.all()[0], 'date': blog.entry_dates['day'][0] })
def handle_noargs(self, **options): key = options.pop('key', '') idle = options.pop('idle', False) syncdb_opts = deepcopy(options) syncdb_opts['migrate_all'] = False syncdb_opts['interactive'] = False syncdb_opts['migrate'] = False syncdb_opts['database'] = 'default' migrate_opts = deepcopy(options) migrate_opts['fake'] = False migrate_opts['interactive'] = False try: cachetable = CreateCacheTable() cachetable.stdout = self.stdout cachetable.stderr = self.stderr cachetable.handle('django_dbcache', database='default') self.stdout.write('created cache table "django_dbcache"') except CommandError: self.stdout.write('not created cache table "django_dbcache". already exists.') self.stdout.write("Detecting database status\n") try: with commit_on_success(): MigrationHistory.objects.count() except DatabaseError: self.stdout.write("No database yet, but NOT running full syncdb anyway (because that causes problems with django-cms 3 cms plugin table renames).\n") if False: self.stdout.write("No database yet, running full syncdb\n") syncdb_opts['migrate_all'] = True migrate_opts['fake'] = True syncdb = SyncDB() syncdb.stdout = self.stdout syncdb.stderr = self.stderr syncdb.handle_noargs(**syncdb_opts) migrate = Migrate() migrate.stdout = self.stdout migrate.stderr = self.stderr migrate.handle(**migrate_opts) datayaml = os.path.join(settings.PROJECT_DIR, 'data.yaml') if os.path.exists(datayaml): self.stdout.write("Found data.yaml, trying to load.\n") activate(settings.CMS_LANGUAGES[0][0]) os.chdir(settings.PROJECT_DIR) loader = Loader() loader.load(datayaml) else: self.stdout.write("data.yaml not found, not loading any data.\n") if idle: self.stdout.write("running dummy http server for unknown reasons.\n") dummy_http()
def setUp(self): if 'south' in settings.INSTALLED_APPS: from south.management.commands.migrate import Command command = Command() command.handle(all_apps=True)