未能升级Django CMS项目

时间:2012-12-11 14:59:44

标签: django django-south django-cms migrate

我正在尝试将Django CMS从2.2.x升级到2.3.5,将Django从1.3.x升级到1.4.3。

当我尝试从南方使用迁移时,出现错误,我无法开始工作。

 
Error in migration:googlemap:0012_auto__add_field_googlemap_width__add_field_googlemap_height__chg_field
  Traceback (most recent call last):
  File "manage.py", line 19, in 
    execute_from_command_line(sys.argv)
  File "/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/management/commands/migrate.py", line 108, in handle
    ignore_ghosts = ignore_ghosts,
  File "/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/migration/__init__.py", line 213, in migrate_app
    success = migrator.migrate_many(target, workplan, database)
  File "/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/migration/migrators.py", line 235, in migrate_many
    result = migrator.__class__.migrate_many(migrator, target, migrations, database)
  File "/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/migration/migrators.py", line 310, in migrate_many
    result = self.migrate(migration, database)
  File "/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/migration/migrators.py", line 133, in migrate
    result = self.run(migration)
  File "/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/migration/migrators.py", line 107, in run
    return self.run_migration(migration)
  File "/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/migration/migrators.py", line 81, in run_migration
    migration_function()
  File "/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/migration/migrators.py", line 57, in 
    return (lambda: direction(orm))
  File "/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/cms/plugins/googlemap/migrations/0012_auto__add_field_googlemap_width__add_field_googlemap_height__chg_field.py", line 19, in forwards
    keep_default=False)
  File "/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/db/sqlite3.py", line 31, in add_column
    field.column: self._column_sql_for_create(table_name, name, field, False),
  File "/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/db/generic.py", line 44, in _cache_clear
    return func(self, table, *args, **opts)
  File "/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/db/sqlite3.py", line 103, in _remake_table
    ", ".join(["%s %s" % (self.quote_name(cname), ctype) for cname, ctype in definitions.items()]),
  File "/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/db/generic.py", line 273, in execute
    cursor.execute(sql, params)
  File "/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/django/db/backends/util.py", line 44, in execute
    sql = self.db.ops.last_executed_query(self.cursor, sql, params)
  File "/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/django/db/backends/__init__.py", line 595, in last_executed_query
    return smart_unicode(sql) % u_params
TypeError: not enough arguments for format string 

由于无法正确迁移,我的项目中出现以下错误

no such column: cmsplugin_googlemap.height

我该怎么办?

已修改:添加了通过常规pip安装安装的googlemap / models.py

from django.db import models
from django.utils.translation import ugettext_lazy as _
from cms.models import CMSPlugin


class GoogleMap(CMSPlugin):
   """
   A google maps integration
   """
   title = models.CharField(_("map title"), max_length=100, blank=True,
                         null=True)

   address = models.CharField(_("address"), max_length=150)
   zipcode = models.CharField(_("zip code"), max_length=30)
   city = models.CharField(_("city"), max_length=100)

   content = models.CharField(_("additional content"), max_length=255,
                     blank=True,
                     help_text=_('Displayed under address in the bubble.'))
   ZOOM_LEVELS = map(lambda c: (c, str(c)), range(22))
   zoom = models.PositiveSmallIntegerField(_("zoom level"),
                                        choices=ZOOM_LEVELS, default=13)

   lat = models.DecimalField(_('latitude'), max_digits=10, decimal_places=6,
                          null=True, blank=True,
                          help_text=_('Use latitude & longitude to fine '
                                      'tune the map position.'))
   lng = models.DecimalField(_('longitude'), max_digits=10, decimal_places=6,
                          null=True, blank=True)

   route_planer_title = models.CharField(_("route planer title"),
                           max_length=150, blank=True, null=True,
                           default=_('Calculate your fastest way to here'))
   route_planer = models.BooleanField(_("route planer"), default=False)

   width = models.CharField(_('width'), max_length=6, default='100%',
                       help_text=_('Plugin width (in pixels or percent).'))
   height = models.CharField(_('height'), max_length=6, default='400px',
                          help_text=_('Plugin height (in pixels).'))

   def __unicode__(self):
       return u"%s (%s, %s %s)" % (self.get_title(), self.address,
                                self.zipcode, self.city,)

   def get_title(self):
       if self.title is None:
           return _("Map")
       return self.title

   def get_lat_lng(self):
       if self.lat and self.lng:
           return (self.lat, self.lng)

0 个答案:

没有答案