나는 Trac의 데이터베이스를 검사 할 때 내가 얻을 :장고 사용자 정의 기본 키
class TicketChange(models.Model):
ticket = models.IntegerField()
time = models.BigIntegerField()
author = models.TextField(blank=True)
field = models.TextField()
oldvalue = models.TextField(blank=True)
newvalue = models.TextField(blank=True)
class Meta:
managed = False
db_table = 'ticket_change'
기본 키와 함께 :
>>> TicketChange.objects.all()
DatabaseError: column ticket_change.id does not exist
LINE 1: SELECT "ticket_change"."id", "ticket_change"."ticket", "tick...
나는 PK하지만 ticket_change
의 원래 기본 키를 지정해야하기 때문에
Primary key (ticket, time, field)
그러나 그것은 장고에 가능하지 : Trac에이다 Django Multi-Column Primary Key Discussion.
pk처럼 time
을 정의하면 동시에 두 티켓 변경을 추가 할 수 없습니다.
어떻게해야합니까?