Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/283.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python Django模型缩进错误_Python_Django_Indentation - Fatal编程技术网

python Django模型缩进错误

python Django模型缩进错误,python,django,indentation,Python,Django,Indentation,我得到了这个错误 我正在使用带有空格的gedit作为制表符的选项(还尝试了更改制表符宽度)…我几乎可以肯定代码是正确的..但是空格和制表符有一些问题..应该是这样的 verbose_name_plural = "Categories" ^ IndentationError: expected an indented block 由于verbose\u name\u复数应位于类Meta中,因此应识别它 from django.db import mod

我得到了这个错误

我正在使用带有空格的gedit作为制表符的选项(还尝试了更改制表符宽度)…我几乎可以肯定代码是正确的..但是空格和制表符有一些问题..

应该是这样的

verbose_name_plural = "Categories"
                  ^ IndentationError: expected an indented block
由于
verbose\u name\u复数
应位于
类Meta
中,因此应识别它

    from django.db import models

    class Category(models.Model):
        title = models.CharField(max_length=250)
        slug = models.SlugField(unique=True)
        description = models.TextField()

        class Meta:
            verbose_name_plural = "Categories"

        def __unicode__(self):
            return self.title
类Meta:
之后没有正确缩进

    from django.db import models

    class Category(models.Model):
        title = models.CharField(max_length=250)
        slug = models.SlugField(unique=True)
        description = models.TextField()

        class Meta:
            verbose_name_plural = "Categories"

        def __unicode__(self):
            return self.title
class Meta:
    verbose_name_plural = "Categories"