Hi

I was wondering whether anyone could help me, I just starting out with
Django and am attempting to write a simple web app. Ideally I'd like
to use a slug field populated based on the name of my product.

However the slug field is not being populated, my model looks like
this:

class Product(models.Model):

    name = models.CharField(maxlength=255)
    category = models.ForeignKey(Category)
    slug =
models.SlugField(prepopulate_from=("name",),unique=True,editable=False)
    description = models.TextField()
    size = models.CharField(maxlength=50)
    price = models.FloatField(max_digits=5, decimal_places=2)
    delivery = models.ForeignKey(Delivery)
    in_stock = models.BooleanField()
    display = models.BooleanField()
    pub_date = models.DateTimeField(editable=False)

    def __str__(self):
        return self.name

    def save(self):
        if not self.id:
            self.pub_date = datetime.datetime.now()
        super(Product, self).save()

Any help would be greatly appreciated


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to