The error: "unindent does not match any outer indentation level"
means that you have a line of code that is less indented than the
immediately previous line, but is not lined up with any line before
that. In your case, it's this line:
def __unicode__(self):
which should be indented exactly as much as the line:
def get_absolute_url(self):
--Fred
Fred Stluka -- mailto:fred@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.
Fred Stluka -- mailto:fred@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.
On 7/5/16 6:21 AM, deepak manupati wrote:
--
am getting unindentation error can any one fix my problem
File "/home/deepak/Desktop/ecommerce-2/src/products/models.py", line 31
def get_absolute_url(self):
from django.core.urlresolvers import reverse
from django.db import models
class ProductQuerySet(models.query.QuerySet):
def active(self):
return self.filter(active=True)
class ProductManager(models.Manager):
def get_queryset(self):
return ProductQuerySet(self.model,using=self._db)
def all(self,*args,**kwargs):
return self.get_queryset().active()
class Product(models.Model):
title = models.CharField(max_length=120)
description = models.TextField(blank=True, null=True)
price = models.DecimalField(decimal_places=2, max_digits=20)
active = models.BooleanField(default=True)
objects = ProductManager()
def get_absolute_url(self):
return reverse("product_detail", kwargs={"pk":self.pk})
def __unicode__(self):
return self.title
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fd982cf1-e022-4953-8764-34b78c511cbc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment