Django save, column specified twice
Posted
by realshadow
on Stack Overflow
See other posts from Stack Overflow
or by realshadow
Published on 2010-05-16T13:58:24Z
Indexed on
2010/05/16
14:00 UTC
Read the original article
Hit count: 343
Hey,
I would like to save a modified model, but I get Programming error - that a field is specified twice.
class ProductInfo(models.Model):
product_info_id = models.AutoField(primary_key=True)
language_id = models.IntegerField()
product_id = models.IntegerField()
description = models.TextField(blank=True)
status = models.IntegerField()
model = models.CharField(max_length=255, blank=True)
label = models.ForeignKey(Category_info, verbose_name = 'Category_info', db_column = 'language_id', to_field = 'node_id', null = True)
I get this error because the foreign key uses as db_column language_id. If I will delete it, my object will be saved properly.
I dont quite understand whats going on and since I have defined almost all of my models this way, I fear its totally wrong or maybe I just missunderstood it...
Any ideas?
Regards
© Stack Overflow or respective owner