0
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

I am getting this error

verbose_name_plural = "Categories"
                  ^ IndentationError: expected an indented block

I am using gedit with use spaces as option for tabs ( also tried altering tab width)..I am almost certain that the code is correct..but some problem with spacing and tabs..

0

2 Answers 2

5
class Meta:
    verbose_name_plural = "Categories"

You are not indenting correctly after class Meta:.

Sign up to request clarification or add additional context in comments.

Comments

3

it should be

    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

Since verbose_name_plural is expected to be in class Meta, it should be idented.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.