I need to creaet records in model Tabel after creation moden Vacation. I have Employee who creates a vacation and each date from the duration of vacation has to go to model Tabel.
name = models.CharField('Name', max_length = 20)
last_name = models.CharField('Last name', max_length = 20)
def __str__(self):
return self.last_name
class Vacation(models.Model):
employee = models.ForeignKey(Employee, on_delete = models.SET_NULL, blank = True, null = True)
vacation_type = models.ForeignKey(VacationType, on_delete = models.SET_NULL, blank = True, null = True)
date_creation = models.DateTimeField(auto_now = True)
start_date = models.DateField()
end_date = models.DateField()
duration = models.DurationField(default=timedelta)
class Tabel(models.Model):
employee = models.ForeignKey(Employee, on_delete = models.SET_NULL, blank = True, null = True)
date = models.DateField()
day_type = models.ForeignKey(TabelType, on_delete = models.SET_NULL, blank = True, null = True)
late_changes = models.BooleanField(default = False)
I just start with Django. What shoud I use to update model Tabel after Vacation creation? Thank you in advance for any advice!