help me please...

TypeError at /admin/myshop/catalogcategory/add/

'NoneType' object has no attribute '__getitem__'

Request Method:POSTRequest URL:
http://127.0.0.1:8000/admin/myshop/catalogcategory/add/?_popup=1Django 
Version:1.5Exception Type:TypeErrorException Value:

'NoneType' object has no attribute '__getitem__'

Exception 
Location:/root/Dev/project/local/lib/python2.7/site-packages/django/contrib/admin/models.py
 
in log_action, line 18Python Executable:/root/Dev/project/bin/pythonPython 
Version:2.7.3
---------------------------------------------------------------------------------------------------

models.py

 
from django.db import models

class Catalog(models.Model):
    name = models.CharField(max_length=255)
    slug = models.SlugField(max_length=150)
    publisher = models.CharField(max_length=300)
    description = models.TextField()
    pub_date = models.DateTimeField('date published')

class CatalogCategory(models.Model):
    catalog = models.ForeignKey(Catalog, related_name='categories')
    parent = models.ForeignKey('self', blank=True, null=True, 
related_name='children')
    name = models.CharField(max_length=255)
    slug = models.SlugField(max_length=255, unique=True)
    description = models.TextField(blank=True)
    date = models.DateTimeField('date published')
    def __unicode__(self):
        if self.parent:
            return u'%s: %s - %s' % (self.catalog.name, 
self.parent.name,self.name)
            return u'%s: %s' % (self.catalog.name, self.name)

class Product(models.Model):
    category = models.ForeignKey(CatalogCategory, related_name='products')
    name = models.CharField(max_length=255)
    slug = models.SlugField(max_length=255)
    description = models.TextField()
    photo = models.ImageField(upload_to='product_photo', blank=True)
    manufacturer = models.CharField(max_length=255, blank=True)
    price_in_dollars = models.DecimalField(max_digits=6,decimal_places=2)


class ProductAttribute(models.Model):
    name = models.CharField(max_length=300)
    description = models.TextField(blank=True)

    def __unicode__(self):
        return u'%s' % (self.name)

class ProductDetail(models.Model):
    product = models.ForeignKey(Product, related_name='details')
    attribute = models.ForeignKey(ProductAttribute)
    value = models.CharField(max_length=500)
    description = models.TextField(blank=True)

    def __unicode__(self):
        return u'%s: %s - %s' % (self.product, self.attribute, self.value)


-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8c8228ed-893d-455e-aad1-06063973cfbf%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to