How can I set the date_in filed to null at the time of entry and update the value to the date book is returned.
class Book_Loans(models.Model):
Loan_id = models.AutoField(primary_key=True)
Isbn = models.ForeignKey('Books')
Card_id = models.ForeignKey('Borrower')
Date_out = models.DateField(auto_now_add = True, auto_now = False)
Due_date = models.DateField(default = get_deadline())
Date_in = models.DateField(null = True,auto_now_add = False, auto_now = True)
def __unicode__(self):
return str(self.Loan_id)
Aucun commentaire:
Enregistrer un commentaire