小编Ali*_*zaJ的帖子

FieldError:无法将关键字"XXXX"解析为字段

这是一个非常奇怪的错误.我只在我的heroku服务器上收到它.

以下是我的模型:

# Abstract Model

class CommonInfo(models.Model):
    active = models.BooleanField('Enabled?', default=False)
    date_created = models.DateTimeField(auto_now_add=True)
    date_updated = models.DateTimeField(auto_now=True)

    class Meta:
        abstract = True


class Country(CommonInfo):
    name = models.CharField('Country Name', db_index=True, max_length=200, help_text='e.g. France')
    official_name = models.CharField('Official Name', max_length=400, blank=True, help_text='e.g. French Republic')
    population = models.IntegerField('Population', help_text='Population must be entered as numbers with no commas or separators, e.g. 39456123', null=True, blank=True)
    alpha2 = models.CharField('ISO ALPHA-2 Code', max_length=2, blank=True)


class News(CommonInfo):
    title = models.CharField('Title', max_length=250)
    slug = models.CharField('slug', max_length=255, unique=True)
    body = models.TextField('Body', …
Run Code Online (Sandbox Code Playgroud)

python django

11
推荐指数
2
解决办法
3万
查看次数

标签 统计

django ×1

python ×1