class PesPayrollLedger(models.Model):
person = models.ForeignKey(Person,null=False,blank=False)
year = models.IntegerField(null=False,blank=False)
month = models.IntegerField(null=False,blank=False,choices=month_choices)
cutoff_id = models.IntegerField(null=False,blank=False,choices=cutoff_choices)
payroll_account = models.ForeignKey(PesPayrollAccounts,null=False,blank=False)
amount = models.DecimalField(max_digits=11, decimal_places=4,null=False,blank=False)
compensation_avail_id = models.IntegerField(null=True,blank=True)
status = models.IntegerField(default=0)
source_cutoff = models.IntegerField()
class Meta:
db_table = 'pes_payroll_ledger'
def __unicode__(self):
return str(self.payroll_account)+' ('+str(self.amount)+')'
我刚刚表演过:
l = PesPayrollLedger(person_id=505, year=2013, month=9, cutoff_id=2, payroll_account_id=2, amount = 22.0000, source_cutoff = 201391, status=0, compensation_avail_id=83)
l.save()
没有错误,数据库中没有保存任何条目。 我错过了什么?
答案 0 :(得分:1)