Thursday, July 31, 2014

Re: invalid attribute

Do you have the full error message?

On Thursday, July 31, 2014 5:48:55 PM UTC-4, ngangsia akumbo wrote:
Got an invalid attribut error

class Product(models.Model):
    name = models.CharField(max_length=255, unique=True)
    slug = models.SlugField(max_length=255, unique=True,
            help_text="Each product has a unique name")
    brand = models.CharField(max_length=50)
    sku = models.CharField(max_length=50)
    price = models.DecimalField(max_length=9, decimal_places=3)
    old_price = models.DecimalField(max_length=9, decimal_places=3, blank=True, default=0.00)
    image = models.CharField(max_length=50)
    is_active = models.BooleanField(default=True)
    is_bestseller = models.BooleanField(default=False)
    is_featured = models.BooleanField(default=False)
    quantity = models.IntegerField()
    description = models.TextField()
    meta_keywords = models.CharField('Meta Keywords', max_length=300)
    meta_description = models.CharField("Meta Description", max_length=255)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)
    category = models.ManyToManyField(Category)

    class Meta:
        db_table = 'products'
        ordering = ['-created_at']

        def __unicode(self):

        def get_absolute_url(self):
            return ('catalog_product', (), { 'product_slug': self.slug })

        def sale_price(self):
            if self.old_price > self.price:
                return self.price
                return None


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
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment