我在Django上使用South迁移遇到了错误。我在我的模型中包含了几个新字段。我可以运行python manage.py syncdb
和python manage.py schemamigrations retailers
但是当我尝试迁移时,我会遇到...
FATAL ERROR - The following SQL query failed: CREATE TABLE "retailers_tag" ("id" integer NOT NULL PRIMARY KEY, "name" varchar(100) NOT NULL, "slug" varchar(50) NOT NULL UNIQUE)
The error was: table "retailers_tag" already exists
ValueError: Cannot import the required field 'autoslug.fields.AutoSlugField'
我的模型如下:
from django.db import models
from django_extensions.db.fields import AutoSlugField
class Tag(models.Model):
tag = models.CharField(max_length=100)
slug = AutoSlugField(populate_from='name', unique=True)
def __unicode__(self):
return self.tag
class City(models.Model):
city = models.CharField(max_length=100)
slug = AutoSlugField(populate_from='name', unique=True)
def __unicode__(self):
return self.city
class Listings(models.Model):
listing = models.CharField(max_length=50)
description = models.CharField(max_length=500)
email = models.EmailField(max_length=75)
url = models.URLField(max_length = 200)
tag = models.ManyToManyField(Tag)
city = models.ManyToManyField(City)
pub_date = models.DateTimeField(auto_now=True)
def __unicode__(self):
return self.listing
我是Django / South的新手!在此先感谢您的帮助。