- # If primary key id is a serial int, get next id
- if self.fields[self.primary_key].type in (IntType, LongType):
+ # If primary key id is a serial int and it isnt included, get next id
+ if self.fields[self.primary_key].type in (IntType, LongType) and \
+ self.primary_key not in self: