Hi! I got the following table definition on inspect db:
class KevinExample(models.Model): * code = models.CharField(db_column='Code', primary_key=True, max_length=50) # Field name made lowercase. lineid = models.IntegerField(db_column='LineId') # Field name made lowercase.* object = models.CharField(db_column='Object', max_length=20, blank=True, null=True) # Field name made lowercase. loginst = models.IntegerField(db_column='LogInst', blank=True, null=True) # Field name made lowercase. u_contrattr = models.ForeignKey('KevinExpAttr', models.DO_NOTHING, db_column='U_contrattr', max_length=50, blank=True, null=True) # Field name made lowercase. u_attrlinedata = models.CharField(db_column='U_attrlinedata', max_length=50) # Field name made lowercase. class Meta: managed = False db_table = '@KEVIN_EXAMPLE' *unique_together = (('code', 'lineid'),)* Inserting new rows by using the constructor and force_insert works fine but refresh_from_db() as well as save() is not possible (duplicate key constraint). Problem is, code + lineid is PK and I have to keep it like this (foreign table). Is there a workaround for this? Is it still impossible to define such PK on latest Django? Kind regards Kevin -- 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 django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/857e15d5-e46b-4f1e-b1f3-e5c24b1f3bd8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.