Hello,

I would like to implement multicolumns primary keys in django.

I've tried to implement an AutoSlugField() which concatenate my
columns values(foreignkey/dates) ...

models.py :

class ProductProduction(models.Model):
enterprise = models.ForeignKey('Enterprise')
product = models.ForeignKey('Product')
date = models.DateTimeField() count = models.IntegerField()
slug = AutoSlugField(populate_from=lambda instance:
instance.enterprise.username + '-' + instance.product.name + '-' +
str(instance.date))

When I pass the following parameters : -
'Megacorp','robot','09/10/2010',5 => slug = 'Megacorp-
robot-09/10/2010' ... the next time in pass the triplet, a new value
has been inserted : - 'Megacorp','robot','09/10/2010',10 => slug =
'Megacorp-robot-09/10/2010' => same slug value => insert ????

I tried to add primary_key=True parameter to the slug... but it
creates new instance with a "-1" "-2" ... and NO update is made at
all...

Did I miss something ?

Thanks,

Yoan

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

Reply via email to